Skip to main content

GetConfig

Trait GetConfig 

Source
pub trait GetConfig: Send + Sync {
    // Required methods
    fn get_config(&self, key: ConfigKey) -> Value;
    fn get_config_at(&self, key: ConfigKey, version: CommitVersion) -> Value;

    // Provided methods
    fn get_config_uint8(&self, key: ConfigKey) -> u64 { ... }
    fn get_config_uint1(&self, key: ConfigKey) -> u8 { ... }
    fn get_config_duration(&self, key: ConfigKey) -> StdDuration { ... }
    fn get_config_duration_opt(&self, key: ConfigKey) -> Option<StdDuration> { ... }
}
Expand description

Trait for fetching configuration values.

Required Methods§

Source

fn get_config(&self, key: ConfigKey) -> Value

Get the configuration value at the current snapshot.

Source

fn get_config_at(&self, key: ConfigKey, version: CommitVersion) -> Value

Get the configuration value at a specific snapshot version.

Provided Methods§

Source

fn get_config_uint8(&self, key: ConfigKey) -> u64

Get the current value as a u64. Panics if the value is not Value::Uint8.

Source

fn get_config_uint1(&self, key: ConfigKey) -> u8

Get the current value as a u8. Panics if the value is not Value::Uint1.

Source

fn get_config_duration(&self, key: ConfigKey) -> StdDuration

Get the current value as a std::time::Duration. Panics if the value is not Value::Duration.

Source

fn get_config_duration_opt(&self, key: ConfigKey) -> Option<StdDuration>

Get the current value as an Option<StdDuration> for keys that may be unset. None for Value::None, Some(d) for Value::Duration(d). Panics on any other variant.

Implementors§