Trait configure::Configure [] [src]

pub trait Configure: Sized {
    fn generate() -> Result<Self, DeserializeError>;

    fn regenerate(&mut self) -> Result<(), DeserializeError> { ... }
}

A configuration struct which can be generated from the environment.

This trait is normally derived using the configure_derive crate.

Be careful when using this code, it's not being tested!
#[derive(Configure)]
pub struct Config {
    /// This can be set through the LIBNAME_HOST variable
    pub host: SocketAddr,
    /// This can be set through the LIBNAME_THREADS variable
    pub threads: usize,
}

// To generate your configuration from the environment:
let cfg = Config::generate()?;

Required Methods

Generate this configuration from the ambient environment.

Provided Methods

Regenerate this configuration.

Implementors