Files
LLeMbas-TTY/config/src/meta.rs
T
Wez Furlong 8508860136 config: derive some metadata about the config
This isn't used by anything yet, but will enable some runtime
config editing functions that I have planeed for the future.
2022-09-22 06:09:31 -07:00

34 lines
931 B
Rust

use wezterm_dynamic::Value;
/// Trait for returning metadata about config options
pub trait ConfigMeta {
fn get_config_options(&self) -> &'static [ConfigOption];
}
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum ConfigContainer {
None,
Option,
Vec,
Map,
}
/// Metadata about a config option
pub struct ConfigOption {
/// The field name
pub name: &'static str,
/// Brief documentation
pub doc: &'static str,
/// TODO: tags to categorize the option
pub tags: &'static [&'static str],
pub container: ConfigContainer,
/// The type of the field
pub type_name: &'static str,
/// call this to get the default value
pub default_value: Option<fn() -> Value>,
/// TODO: For enum types, the set of possible values
pub possible_values: &'static [&'static Value],
/// TODO: For struct types, the fields in the child struct
pub fields: &'static [ConfigOption],
}