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§
Source§impl ConfigRegistry
impl ConfigRegistry
Sourcepub fn new(ast: &Ast, macro_symbols: &HashSet<Symbol>) -> Result<Self, Error>
pub fn new(ast: &Ast, 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).
Sourcepub fn items<'a>(&'a self) -> &'a HashMap<ItemReference, Item>
pub fn items<'a>(&'a self) -> &'a HashMap<ItemReference, Item>
Return a reference to the map of the items available in the configuration registry
Returns the name of the main menu
Returns the item belonging to the main menu
Sourcepub fn get<'a>(&'a self, itemref: &ItemReference) -> Option<&'a Item>
pub fn get<'a>(&'a self, itemref: &ItemReference) -> Option<&'a Item>
Finds the item given the item reference, if available, otherwise returns None
Sourcepub fn get_info(&self, itemref: &ItemReference) -> Option<Info>
pub fn get_info(&self, itemref: &ItemReference) -> Option<Info>
Returns an item’s information, if available, otherwise returns None
Sourcepub fn item_enabled(&self, itemref: &ItemReference) -> Result<bool, Error>
pub fn item_enabled(&self, itemref: &ItemReference) -> Result<bool, Error>
Given the item reference, determine whether the associated item is enabled
Sourcepub fn current_config_item(&self, itemref: &ItemReference) -> Option<ConfigItem>
pub fn current_config_item(&self, itemref: &ItemReference) -> Option<ConfigItem>
Returns a clone of the active configuration item, if available
Sourcepub fn mutation_start(&self, itemref: &ItemReference) -> Option<MutationStart>
pub fn mutation_start(&self, itemref: &ItemReference) -> Option<MutationStart>
Returns how to start a mutation. Given the configuration type, this can be a different start situation.
Sourcepub fn current_value(&self, itemref: &ItemReference) -> Option<Variant>
pub fn current_value(&self, itemref: &ItemReference) -> Option<Variant>
The current value of an item is resolved according to a number of rules:
If the value has been selected through a select reverse dependency, then this value will be used, with respect to it’s default value.
If the value has a “regular” value, then this value will be used
If the value has been selected through an implied value, then this value will be used, with respect to it’s default value.
Otherwise, the default value will be used.
Sourcepub fn current_value_is_default(&self, itemref: &ItemReference) -> bool
pub fn current_value_is_default(&self, itemref: &ItemReference) -> bool
Determines whether the value if the configuration item internal to the item is set to it’s default value.
Sourcepub fn set_value(
&mut self,
itemref: &ItemReference,
value: Variant,
) -> Result<(), Error>
pub fn set_value( &mut self, itemref: &ItemReference, value: Variant, ) -> Result<(), Error>
Sets the value of a configuration item either by loading it from an earlier stored session, or by entering the data programmatically/through a configuration editor. Returns nothing if successful, or an error if for some reason the value could not be set properly.
Sourcepub fn discard_value(&mut self, itemref: &ItemReference) -> Result<(), Error>
pub fn discard_value(&mut self, itemref: &ItemReference) -> Result<(), Error>
Unsets the value of a configuation item
Sourcepub fn find_itemref(&self, name: &str) -> Option<ItemReference>
pub fn find_itemref(&self, name: &str) -> Option<ItemReference>
Finds the appropriate item reference by the name of the itemreference
Sourcepub fn reset(&mut self) -> Result<(), Error>
pub fn reset(&mut self) -> Result<(), Error>
Evaluates all items and enforces the proper rules on all internal configuration items and dependent configuration items for all the items evaluated.
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.