Skip to main content

FlagExtra

Struct FlagExtra 

Source
pub struct FlagExtra<'a> {
Show 35 fields pub display_order: Option<u32>, pub hidden_shorts: &'a [u8], pub hidden_longs: &'a [&'a str], pub admonitions: &'a [AdmonitionMeta<'a>], pub deprecated: Option<&'a str>, pub deprecated_warn_at: Option<&'a str>, pub deprecated_remove_at: Option<&'a str>, pub value_names: &'a [&'a str], pub env_fallback: &'a [&'a str], pub deprecated_env: &'a [&'a str], pub choice_aliases: &'a [(&'a str, &'a str)], pub choice_details: &'a [ChoiceMeta<'a>], pub validate: Option<&'a str>, pub validate_error: Option<&'a str>, pub hide_env_values: bool, pub complete_type: Option<&'a str>, pub var_min: Option<u32>, pub var_max: Option<u32>, pub value_var_min: Option<u32>, pub value_var_max: Option<u32>, pub overrides: &'a [&'a str], pub conflicts: &'a [&'a str], pub delimiter: Option<char>, pub exclusive: bool, pub requires: &'a [&'a str], pub requires_if: &'a [RequiresIf<'a>], pub default_if: &'a [DefaultIf<'a>], pub required_if: &'a [&'a str], pub required_if_eq: &'a [RequiredIfEq<'a>], pub required_if_eq_all: &'a [RequiredIfEq<'a>], pub required_unless: &'a [&'a str], pub required_unless_all: &'a [&'a str], pub surface: Option<&'a str>, pub available_if: &'a [&'a str], pub effect: Option<Effect>,
}
Expand description

The rarely declared part of a FlagMeta, behind one pointer.

Most flags have help, maybe a default and a heading, and nothing here. Holding these inline made every flag’s metadata several hundred bytes of mostly empty fields in the binary.

Fields§

§display_order: Option<u32>

Explicit placement within its help section.

§hidden_shorts: &'a [u8]

Short forms accepted by the parser but omitted from help and completion.

§hidden_longs: &'a [&'a str]

Long forms accepted by the parser but omitted from help and completion.

§admonitions: &'a [AdmonitionMeta<'a>]

Notes and warnings shown after the extended help text.

§deprecated: Option<&'a str>

Why this flag is deprecated, plus optional release milestones.

§deprecated_warn_at: Option<&'a str>§deprecated_remove_at: Option<&'a str>§value_names: &'a [&'a str]

Ordered placeholders for one fixed-arity occurrence.

§env_fallback: &'a [&'a str]§deprecated_env: &'a [&'a str]§choice_aliases: &'a [(&'a str, &'a str)]

Canonical-to-alias pairs used when emitting a lossless spec.

§choice_details: &'a [ChoiceMeta<'a>]

Per-canonical presentation metadata used when emitting a lossless spec.

§validate: Option<&'a str>

Portable expr expression evaluated for each raw value.

§validate_error: Option<&'a str>

Message reported when validation returns false.

§hide_env_values: bool§complete_type: Option<&'a str>

A built-in completion class such as path or dir.

§var_min: Option<u32>§var_max: Option<u32>§value_var_min: Option<u32>

Bounds on values consumed by one occurrence, distinct from the flag-level occurrence bounds above.

§value_var_max: Option<u32>§overrides: &'a [&'a str]

Flags this one displaces when both are given.

§conflicts: &'a [&'a str]

Flags that cannot be given alongside this one.

Where overrides resolves a collision by letting the last flag win, this reports it: the combination has no meaning, so honouring one side silently would hide a mistake.

§delimiter: Option<char>

The character one word is split on to make several values, as clap’s value_delimiter does. Only ever set where several values can land.

§exclusive: bool

Whether this flag must be given on its own.

The whole-command form of conflicts: everything the command declares counts, positionals included.

§requires: &'a [&'a str]

Flags that must also be given when this one is.

The positive form of conflicts, and the mirror image of required_if: the same rule written on the flag that imposes it rather than on the flag it lands on.

§requires_if: &'a [RequiresIf<'a>]

Value-triggered requirements declared by this flag.

§default_if: &'a [DefaultIf<'a>]

Defaults that apply when another flag is given.

§required_if: &'a [&'a str]

Flags that make this one necessary.

§required_if_eq: &'a [RequiredIfEq<'a>]

Selector/value conditions, any one of which makes this required.

§required_if_eq_all: &'a [RequiredIfEq<'a>]

Selector/value conditions which must all match to make this required.

§required_unless: &'a [&'a str]

Flags that make this one unnecessary.

§required_unless_all: &'a [&'a str]

All selectors must be present to make this unnecessary.

§surface: Option<&'a str>

Named audience or compatibility surface this flag belongs to.

§available_if: &'a [&'a str]

Descriptive availability conditions; they do not affect parsing.

§effect: Option<Effect>

Implementations§

Source§

impl FlagExtra<'_>

Source

pub const EMPTY: FlagExtra<'static>

Nothing declared, for struct update syntax.

Trait Implementations§

Source§

impl<'a> Clone for FlagExtra<'a>

Source§

fn clone(&self) -> FlagExtra<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for FlagExtra<'a>

Source§

impl<'a> Debug for FlagExtra<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for FlagExtra<'a>

§

impl<'a> RefUnwindSafe for FlagExtra<'a>

§

impl<'a> Send for FlagExtra<'a>

§

impl<'a> Sync for FlagExtra<'a>

§

impl<'a> Unpin for FlagExtra<'a>

§

impl<'a> UnsafeUnpin for FlagExtra<'a>

§

impl<'a> UnwindSafe for FlagExtra<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.