Struct gflags::custom::Arg

source ·
pub struct Arg { /* private fields */ }
Expand description

Raw argument value given for a non-boolean flag.

Implementations§

Access the raw value given on the command line, which may not be legal UTF-8.

Examples found in repository?
src/value.rs (line 47)
46
47
48
    fn parse(arg: Arg) -> Result<Self> {
        Ok(arg.get_raw())
    }
More examples
Hide additional examples
src/arg.rs (line 26)
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.

Examples found in repository?
src/value.rs (line 41)
40
41
42
    fn parse(arg: Arg) -> Result<Self> {
        Ok(arg.get_str())
    }

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
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.