pub struct Arg { /* private fields */ }
Expand description
Raw argument value given for a non-boolean flag.
Access the raw value given on the command line, which may not be legal
UTF-8.
46
47
48
fn parse(arg: Arg) -> Result<Self> {
Ok(arg.get_raw())
}
More examples
Hide additional examples
24
25
26
27
28
29
30
31
32
33
pub fn get_str(self) -> &'static str {
let name = self.name;
match self.get_raw().to_str() {
Some(string) => string,
None => {
eprintln!("Non-unicode arg for {}", name);
process::exit(1);
}
}
}
Access the value assuming it is UTF-8. If not UTF-8, the process will
abort with an error message.
40
41
42
fn parse(arg: Arg) -> Result<Self> {
Ok(arg.get_str())
}
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.