Expand description
A single option.
For Opt(x, y)
:
x
isSome
character, orNone
if no option was found.y
isSome
string, orNone
if no argument was expected.
Example
use getopt::*;
// args = ["program", "-abc", "foo"];
let optstring = "ab:c";
let mut state = State::new();
assert_eq!(
Opt(Some('a'), None),
getopt(&args, optstring, &mut state).unwrap()
);
assert_eq!(
Opt(Some('b'), Some(String::from("c"))),
getopt(&args, optstring, &mut state).unwrap()
);
assert_eq!(
Opt(None, None),
getopt(&args, optstring, &mut state).unwrap()
);
Tuple Fields§
§0: Option<char>
§1: Option<String>
Trait Implementations§
source§impl Ord for Opt
impl Ord for Opt
source§impl PartialOrd<Opt> for Opt
impl PartialOrd<Opt> for Opt
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more