pub enum Arity {
None,
Required,
Optional,
LastArgDefault,
}Expand description
What:
enum Arity lists how an option relates to a value.
An enum is a closed set of
named alternatives.
#[derive(...)] asks the compiler to generate copying (Clone,
Copy),
debug printing (Debug) and == (Eq,
PartialEq).
Why:
Value consumption decides whether the next token is a path or an option value.
In TS you’d write (pseudocode):
type Arity = 'none' | 'required' | 'optional' | 'last-argument-default';Variants§
None
PARSE_OPT_NOARG:
never takes a value;
--name=value is an error.
Required
Takes the attached value,
otherwise the next token (get_arg,
parse-options.c:47-62).
Optional
PARSE_OPT_OPTARG:
takes an attached value only,
never the next token (203-204).
LastArgDefault
PARSE_OPT_LASTARG_DEFAULT:
like Required,
but valid without a value when last (54-55).
Trait Implementations§
impl Copy for Arity
impl Eq for Arity
impl StructuralPartialEq for Arity
Auto Trait Implementations§
impl Freeze for Arity
impl RefUnwindSafe for Arity
impl Send for Arity
impl Sync for Arity
impl Unpin for Arity
impl UnsafeUnpin for Arity
impl UnwindSafe for Arity
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more