pub trait Configure: Sized {
// Required method
fn generate() -> Result<Self, Error>;
// Provided method
fn regenerate(&mut self) -> Result<(), Error> { ... }
}Expand description
A configuration struct which can be generated from the environment.
This trait is normally derived using the configure_derive crate.
ⓘ
#[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§
Provided Methods§
Sourcefn regenerate(&mut self) -> Result<(), Error>
fn regenerate(&mut self) -> Result<(), Error>
Regenerate this configuration.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".