pub trait ConfigInit {
// Required methods
fn parse_options(options: ConfigOptions) -> Result<Self, Error>
where Self: Sized;
fn get_command() -> Command;
// Provided method
fn parse() -> Result<Self, Error>
where Self: Sized { ... }
}
Expand description
Config trait that constructs an instance of itself from environment, command line and configuration files. \
Don’t implement the trait manually,
invoking #[config]
is the only correct way to derive this trait.
Required Methods§
Sourcefn parse_options(options: ConfigOptions) -> Result<Self, Error>where
Self: Sized,
fn parse_options(options: ConfigOptions) -> Result<Self, Error>where
Self: Sized,
Takes all the environment and tries to build an instance according to the options and the structure attributes.
Sourcefn get_command() -> Command
fn get_command() -> Command
Build clap::Command
that can initialize the annotated struct.
Provided Methods§
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.