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§
Sourcefn get_config(&self, key: ConfigKey) -> Value
fn get_config(&self, key: ConfigKey) -> Value
Get the configuration value at the current snapshot.
Sourcefn get_config_at(&self, key: ConfigKey, version: CommitVersion) -> Value
fn get_config_at(&self, key: ConfigKey, version: CommitVersion) -> Value
Get the configuration value at a specific snapshot version.
Provided Methods§
Sourcefn get_config_uint8(&self, key: ConfigKey) -> u64
fn get_config_uint8(&self, key: ConfigKey) -> u64
Get the current value as a u64. Panics if the value is not Value::Uint8.
Sourcefn get_config_uint1(&self, key: ConfigKey) -> u8
fn get_config_uint1(&self, key: ConfigKey) -> u8
Get the current value as a u8. Panics if the value is not Value::Uint1.
Sourcefn get_config_duration(&self, key: ConfigKey) -> StdDuration
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.
Sourcefn get_config_duration_opt(&self, key: ConfigKey) -> Option<StdDuration>
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.