pub enum Argument<'a> {
Long(&'a str),
Short(&'a str),
Bare(&'a str),
}
Expand description
A single argument that can be matched from an ArgumentIterator
.
Variants§
Long(&'a str)
A long argument without the leading dashes.
Argument::Long("help") == arg!(--help)
Short(&'a str)
A short argument without the leading dash.
Argument::Short("h") == arg!(-h)
Important to note that it must be only 1 character long or it
will never match, but for ergonimic reasons it is actually a &str
.
Bare(&'a str)
Raw string of anything else passed as an argument, whether it has zero
or three dashes. Manually constructing an invalid bare argument with leading
dashes won’t be matched properly.
Argument::Bare("---yeet") == arg!("---yeet")
Exists as an alternative to putting parsed arguments in a Result
.
Implementations§
Trait Implementations§
impl<'a> Eq for Argument<'a>
impl<'a> StructuralPartialEq for Argument<'a>
Auto Trait Implementations§
impl<'a> Freeze for Argument<'a>
impl<'a> RefUnwindSafe for Argument<'a>
impl<'a> Send for Argument<'a>
impl<'a> Sync for Argument<'a>
impl<'a> Unpin for Argument<'a>
impl<'a> UnwindSafe for Argument<'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