[][src]Trait preftool::Configuration

pub trait Configuration: Sized + Send + Sync + Clone {
    type Section: Configuration;
    type Sections: IntoIterator<Item = Self::Section>;
    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>; }

Configuration trait. Configuration is thread safe, and cloneable. Clones should be cheap (default config object consits of cloning an Arc and 3 String instances).

Associated Types

type Section: Configuration

Type used for configuration sections.

type Sections: IntoIterator<Item = Self::Section>

Iterator type used to get child sections.

Loading content...

Required methods

fn get<K: Into<ConfigKey>>(&self, key: K) -> Option<&str>

Get a value from the configuration, if it exists.

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.

fn sections(&self) -> Self::Sections

Get all child sections of this configuration, as an iterator.

fn key(&self) -> &ConfigKey

Get the current section key.

fn path(&self) -> &ConfigKey

Get the current section path.

fn value(&self) -> Option<&str>

Get the current section value (if any).

Loading content...

Implementors

Loading content...