#[non_exhaustive]pub struct SpecGroup {
pub name: String,
pub members: Vec<String>,
pub required: bool,
pub multiple: bool,
}Expand description
A set of flags that relate to one another as a set.
Everything here could be written as pairwise conflicts
— for three members, three declarations, and for six, fifteen — except for the part
that cannot: “one of these is required” is a statement about the set, and no rule
written on an individual flag says it.
The two properties are clap’s, and are read the same way:
multiple(defaultfalse) — whether more than one member may be given. The default is what makes a bare group mutual exclusion.required(defaultfalse) — whether at least one member must be given.
So the default group is “at most one of these”, required alone is “exactly one of
these”, and multiple with required is “at least one of these”.
Members use the same selectors as other relationships: --long or -s for a flag,
and the bare argument name for a positional.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringWhat this group is called. Used in messages, and it is how a reader tells two groups apart when a command has several.
members: Vec<String>The arguments in the group, as selectors. Flags use dashed spellings; positionals use their bare names.
required: boolWhether at least one member has to be given.
multiple: boolWhether more than one member may be given.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpecGroup
impl RefUnwindSafe for SpecGroup
impl Send for SpecGroup
impl Sync for SpecGroup
impl Unpin for SpecGroup
impl UnsafeUnpin for SpecGroup
impl UnwindSafe for SpecGroup
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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