pub trait Configuration:
Sized
+ Send
+ Sync
+ Clone {
type Section: Configuration;
type Sections: IntoIterator<Item = Self::Section>;
// Required methods
fn get<K: Into<ConfigKey>>(&self, key: K) -> Option<&str>;
fn section<K: Into<ConfigKey>>(&self, key: K) -> Self::Section;
fn sections(&self) -> Self::Sections;
fn key(&self) -> &ConfigKey;
fn path(&self) -> &ConfigKey;
fn value(&self) -> Option<&str>;
}
Expand description
Configuration trait. Configuration is thread safe, and cloneable. Clones should be cheap (default config object consits of cloning an Arc and 3 String instances).
Required Associated Types§
Sourcetype Section: Configuration
type Section: Configuration
Type used for configuration sections.
Sourcetype Sections: IntoIterator<Item = Self::Section>
type Sections: IntoIterator<Item = Self::Section>
Iterator type used to get child sections.
Required Methods§
Sourcefn get<K: Into<ConfigKey>>(&self, key: K) -> Option<&str>
fn get<K: Into<ConfigKey>>(&self, key: K) -> Option<&str>
Get a value from the configuration, if it exists.
Sourcefn section<K: Into<ConfigKey>>(&self, key: K) -> Self::Section
fn section<K: Into<ConfigKey>>(&self, key: K) -> Self::Section
Get a sub-section from the configuration. This always returns a section, even if it is empty.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.