AnyConfig

Trait AnyConfig 

Source
pub trait AnyConfig: Send + Any {
    // Required methods
    fn status(&self) -> Var<ConfigStatus>;
    fn get_raw(
        &mut self,
        key: Txt,
        default: RawConfigValue,
        insert: bool,
    ) -> Var<RawConfigValue>;
    fn contains_key(&mut self, key: Txt) -> Var<bool>;
    fn remove(&mut self, key: &Txt) -> bool;
    fn low_memory(&mut self);
}
Expand description

Represents one or more config sources behind a dynamic reference.

See Config for the full trait.

Required Methods§

Source

fn status(&self) -> Var<ConfigStatus>

Gets a read-only variable that represents the IO status of the config.

Source

fn get_raw( &mut self, key: Txt, default: RawConfigValue, insert: bool, ) -> Var<RawConfigValue>

Gets a weak typed variable to the config key.

This method is used when T cannot be passed because the config is behind a dynamic reference, the backend must convert the value from the in memory representation to RawConfigValue.

The default value is used if the key is not found in the config, the default value is only inserted in the config if insert, otherwise the key is inserted or replaced only when the returned variable changes.

Source

fn contains_key(&mut self, key: Txt) -> Var<bool>

Gets a read-only variable that tracks if an entry for the key is in the backing storage.

Source

fn remove(&mut self, key: &Txt) -> bool

Removes the key from the backing storage.

Any active config variable for the key will continue to work normally, retaining the last config value and re-inserting the key if assigned a new value.

Returns true if the key was found and will be removed in the next app update. Returns false if the key was not found or the config is read-only.

Source

fn low_memory(&mut self)

Cleanup and flush RAM caches.

Implementors§