pub struct Config {
pub options: GeneralOptions,
pub skill: Option<Box<dyn Skill>>,
}Fields§
§options: GeneralOptions§skill: Option<Box<dyn Skill>>Implementations§
Source§impl Config
impl Config
Sourcepub fn build(args: &[String]) -> Result<Config, String>
pub fn build(args: &[String]) -> Result<Config, String>
Builds a config from a list of args.
§Examples
use practicestuff::Config;
let args = ["cmd".to_string(), "-h".to_string()];
let config = Config::build(&args).unwrap();§Errors
This function will return an error if any part of parsing goes wrong. That include, but is not limited to:
- unrecognised option/command option
- missing or incorrect option argument
- missing command
- ambiguous option/command options arguments
- impossible combination of options/command options
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl !RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl !UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more