Trait ConfigInit

Source
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§

Source

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.

Source

fn get_command() -> Command

Build clap::Command that can initialize the annotated struct.

Provided Methods§

Source

fn parse() -> Result<Self, Error>
where Self: Sized,

Takes all the environment and tries to build an instance according to the structure attributes.

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.

Implementors§