Expand description
An option or positional argument.
This enum can be returned by calls to
Options::next_arg
and represents a
short or long command-line option name (but not value) like Opt
,
or a positional argument.
Variants
Short(A::ShortOpt)
A short option, like -f
. Does not include the leading -
.
Long(A)
A long option, like --file
. Does not include the leading --
.
Positional(A)
A positional argument, like foo.txt
.
Implementations
sourceimpl<A: Argument> Arg<A>
impl<A: Argument> Arg<A>
sourcepub fn opt(self) -> Option<Opt<A>>
pub fn opt(self) -> Option<Opt<A>>
Retrieves an equivalent Opt
represented by this Arg
, if
it is Arg::Short
or Arg::Long
, otherwise None
.
sourcepub fn positional(self) -> Option<A>
pub fn positional(self) -> Option<A>
Returns the positional Argument
represented by this Arg
,
if it is Arg::Positional
, otherwise None
.
Trait Implementations
impl<A: Copy + Argument> Copy for Arg<A> where
A::ShortOpt: Copy,
impl<A: Eq + Argument> Eq for Arg<A> where
A::ShortOpt: Eq,
impl<A: Argument> StructuralEq for Arg<A>
impl<A: Argument> StructuralPartialEq for Arg<A>
Auto Trait Implementations
impl<A> RefUnwindSafe for Arg<A> where
A: RefUnwindSafe,
<A as Argument>::ShortOpt: RefUnwindSafe,
impl<A> Send for Arg<A> where
A: Send,
<A as Argument>::ShortOpt: Send,
impl<A> Sync for Arg<A> where
A: Sync,
<A as Argument>::ShortOpt: Sync,
impl<A> Unpin for Arg<A> where
A: Unpin,
<A as Argument>::ShortOpt: Unpin,
impl<A> UnwindSafe for Arg<A> where
A: UnwindSafe,
<A as Argument>::ShortOpt: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more