pub trait ConfigParser:
Sized
+ Parser
+ ConfigFallback{
// Provided methods
fn parse_with_config() -> Self { ... }
fn try_parse_with_config() -> Result<Self, Error> { ... }
fn parse_with_config_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>,
T: Into<OsString> + Clone { ... }
fn try_parse_with_config_from<I, T>(args: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>,
T: Into<OsString> + Clone { ... }
}Expand description
Parse a clap struct with optional configuration-file fallback.
Deriving ConfigParser generates an internal optional Opts type and a config-deserialization
type, then wires them into this trait.
Provided Methods§
Sourcefn parse_with_config() -> Self
fn parse_with_config() -> Self
Equivalent to Parser::parse, but with config fallback.
Sourcefn try_parse_with_config() -> Result<Self, Error>
fn try_parse_with_config() -> Result<Self, Error>
Equivalent to Parser::try_parse, but with config fallback.
Sourcefn parse_with_config_from<I, T>(itr: I) -> Self
fn parse_with_config_from<I, T>(itr: I) -> Self
Equivalent to Parser::parse_from, but with config fallback.
Sourcefn try_parse_with_config_from<I, T>(args: I) -> Result<Self, Error>
fn try_parse_with_config_from<I, T>(args: I) -> Result<Self, Error>
Performs parsing with config fallback and returns clap errors instead of exiting.
Merge precedence is CLI > config. If no config path is available, behavior matches a normal clap parse.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".