Struct kconfig_represent::ConfigRegistry
source · [−]pub struct ConfigRegistry { /* private fields */ }Expand description
The ConfigRegistry is used to create a registry, which allows reading and writing a configuration to and from a .config file as defined by a Kconfig file. To present the menu, a frontend is necessary to represent the state of the registry.
Implementations
sourceimpl ConfigRegistry
impl ConfigRegistry
sourcepub fn new(
ref_ast: &Ast,
ref_macro_symbols: &HashSet<Symbol>
) -> Result<Self, Error>
pub fn new(
ref_ast: &Ast,
ref_macro_symbols: &HashSet<Symbol>
) -> Result<Self, Error>
Constructs a new configuration registry, given the Abstract syntax tree as loaded from a kconfig-parser’s Ast instance, and the macro symbols discoverd by the macro lexer (if used).
Retrieves the name of the main menu. This serves two purposes:
- It acquires the name for display in the User Interface
- It acquires a needle to find the underlying menu
sourcepub fn lookup_config_mut(
&mut self,
config_item_name: &str
) -> Option<&mut Box<dyn Config>>
pub fn lookup_config_mut(
&mut self,
config_item_name: &str
) -> Option<&mut Box<dyn Config>>
Looks up an internal configuration item as mutable, boxed reference
sourcepub fn lookup_config(&self, config_item_name: &str) -> Option<&Box<dyn Config>>
pub fn lookup_config(&self, config_item_name: &str) -> Option<&Box<dyn Config>>
Looks up an internal configuration as boxed referende
Looks an internal (sub)menu as mutable, boxed reference
Looks up an internal (sub)menu as boxed referende
sourcepub fn config_prompt(&self, config_item_name: &str) -> String
pub fn config_prompt(&self, config_item_name: &str) -> String
Finds the prompt of the given configuration item. If no prompt is found, simply returns the content of the given configuration item name.
Returns the length of the children of the given (sub)menu
Returns the length of the children of the given (sub)menu which are enabled.
Returns if a menu item is enabled, given a descriptor of the menu item.
sourcepub fn iter_enabled_sub_descriptors(
&self,
menu_name: &str
) -> Box<dyn Iterator<Item = MenuItemDescriptor>>
pub fn iter_enabled_sub_descriptors(
&self,
menu_name: &str
) -> Box<dyn Iterator<Item = MenuItemDescriptor>>
Returns and iterator of the descriptors of children of a menu item with the given menu name, which are enabled.
Returns the value as a string of the spefic menu item described by the descriptor.
sourcepub fn descriptor_info(&self, descriptor: &MenuItemDescriptor) -> DescriptorInfo
pub fn descriptor_info(&self, descriptor: &MenuItemDescriptor) -> DescriptorInfo
Returns the menu item’s descriptor information, containing the Help text belonging to the given menu item indicated by the descriptor.
sourcepub fn mutate_through_step(
&mut self,
config_item_name: &str
) -> Result<(), Error>
pub fn mutate_through_step(
&mut self,
config_item_name: &str
) -> Result<(), Error>
Mutates an item by stepping to the next value, this is used for values which can easily be toggled (such as a boolean configuration item).
sourcepub fn mutate_through_string(
&mut self,
config_item_name: &str,
string_value: &str
) -> Result<(), Error>
pub fn mutate_through_string(
&mut self,
config_item_name: &str,
string_value: &str
) -> Result<(), Error>
Mutates an item by loading a string value into the configuration item. Only configuration items which support the ConfigMutationMode::ThroughString are capable of loading a configuration through a string.
sourcepub fn config_mutation_mode(&self, config_item_name: &str) -> ConfigMutationMode
pub fn config_mutation_mode(&self, config_item_name: &str) -> ConfigMutationMode
Returns the mutation mode of a specific configuration item.
sourcepub fn config_value(&self, config_item_name: &str) -> String
pub fn config_value(&self, config_item_name: &str) -> String
Returns the value of a specific configuration item.
sourcepub fn changed(&self) -> bool
pub fn changed(&self) -> bool
Called from the user interface to notify a change should be propagated to all configuration items present.
Recursively gets a (sub)menu from the current menu element by looking up the menu by name
sourcepub fn has_default_value_set(
&self,
descriptor: &MenuItemDescriptor
) -> Option<bool>
pub fn has_default_value_set(
&self,
descriptor: &MenuItemDescriptor
) -> Option<bool>
Checks if the given descriptor of the given (sub)menu is using the default value or not (where applicable).
sourcepub fn write_dotconfig_file(
&self,
dotconfig_filename: &str
) -> Result<(), Error>
pub fn write_dotconfig_file(
&self,
dotconfig_filename: &str
) -> Result<(), Error>
Writes the current configuration known to the configuration registry into a file, typically this file has the file name “.config”
sourcepub fn write_dotconfig(&self, output: &mut dyn Write) -> Result<(), Error>
pub fn write_dotconfig(&self, output: &mut dyn Write) -> Result<(), Error>
Writes the current configuration known to the configuration registry into a Write trait supporting type.
Trait Implementations
sourceimpl Default for ConfigRegistry
impl Default for ConfigRegistry
sourcefn default() -> ConfigRegistry
fn default() -> ConfigRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for ConfigRegistry
impl !Send for ConfigRegistry
impl !Sync for ConfigRegistry
impl Unpin for ConfigRegistry
impl !UnwindSafe for ConfigRegistry
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more