pub enum SimpleOpt<'a> {
Basic(&'a str),
Stdin,
Flag(&'a str),
Pair(&'a str, &'a str),
Done,
Other(&'a Opt),
}Expand description
Alternative labeling of Opt which is easier to use in match statements.
For each variant below, we describe which Opt variant that it is derived from.
§Examples
Here we use Opt::simplify to perform the borrowing:
let x = Long("verbose".to_string());
match x.simplify() {
Flag("v" | "verbose") => println!("Verbose option captured!"),
_ => panic!(),
}Variants§
Basic(&'a str)
Stdin
Flag(&'a str)
Pair(&'a str, &'a str)
Done
Other(&'a Opt)
All other Opt variants not covered
Trait Implementations§
Source§impl<'a> Ord for SimpleOpt<'a>
impl<'a> Ord for SimpleOpt<'a>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialOrd for SimpleOpt<'a>
impl<'a> PartialOrd for SimpleOpt<'a>
impl<'a> Copy for SimpleOpt<'a>
impl<'a> Eq for SimpleOpt<'a>
impl<'a> StructuralPartialEq for SimpleOpt<'a>
Auto Trait Implementations§
impl<'a> Freeze for SimpleOpt<'a>
impl<'a> RefUnwindSafe for SimpleOpt<'a>
impl<'a> Send for SimpleOpt<'a>
impl<'a> Sync for SimpleOpt<'a>
impl<'a> Unpin for SimpleOpt<'a>
impl<'a> UnwindSafe for SimpleOpt<'a>
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