zng::config

Trait Config

source
pub trait Config: AnyConfig {
    // Required method
    fn get<T>(
        &mut self,
        key: impl Into<Txt>,
        default: T,
        insert: bool,
    ) -> Box<dyn VarBoxed<T>>
       where T: ConfigValue;
}
Expand description

Represents one or more config sources.

Required Methods§

source

fn get<T>( &mut self, key: impl Into<Txt>, default: T, insert: bool, ) -> Box<dyn VarBoxed<T>>
where T: ConfigValue,

Gets a variable that is bound to the config key.

The same variable is returned for multiple requests of the same key. If the loaded config is not read-only the returned variable can be set to update the config source.

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.

Object Safety§

This trait is not object safe.

Implementors§