Skip to main content

ArgMeta

Struct ArgMeta 

Source
pub struct ArgMeta<'a> {
Show 38 fields pub arg: &'a Arg<'a>, pub display_order: Option<usize>, pub value_names: &'a [&'a str], pub help: Option<&'a str>, pub long_help: Option<&'a str>, pub env: Option<&'a str>, pub env_fallback: &'a [&'a str], pub deprecated_env: &'a [&'a str], pub default: &'a [&'a str], pub accepted_choices: &'a [&'a str], pub choices: &'a [&'a str], pub choice_aliases: &'a [(&'a str, &'a str)], pub choice_details: &'a [ChoiceMeta<'a>], pub ignore_case: bool, pub allow_unknown_choices: bool, pub validate: Option<&'a str>, pub validate_error: Option<&'a str>, pub required: bool, pub hide: bool, pub hide_default_value: bool, pub hide_env: bool, pub hide_env_values: bool, pub hide_possible_values: bool, pub hide_short_help: bool, pub hide_long_help: bool, pub conflicts: &'a [&'a str], pub requires: &'a [&'a str], 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 var_min: Option<usize>, pub var_max: Option<usize>, pub delimiter: Option<char>, pub help_heading: Option<&'a str>, pub complete: Option<fn(&CompleteCtx<'_>) -> Vec<Candidate<'static>>>, pub complete_type: Option<&'a str>,
}
Expand description

What a positional argument knows about itself beyond how it parses.

Fields§

§arg: &'a Arg<'a>§display_order: Option<usize>

Explicit placement within its help section.

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

Ordered placeholders for a fixed-arity positional.

§help: Option<&'a str>§long_help: Option<&'a str>§env: Option<&'a str>§env_fallback: &'a [&'a str]§deprecated_env: &'a [&'a str]§default: &'a [&'a str]§accepted_choices: &'a [&'a str]

Canonical choices plus aliases accepted by the value type.

§choices: &'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.

§ignore_case: bool§allow_unknown_choices: bool

Accept values outside choices while retaining the list for help and completion.

§validate: Option<&'a str>

Portable expr expression evaluated for each raw value.

§validate_error: Option<&'a str>

Message reported when validation returns false.

§required: bool

Whether the argument must be filled. The parser does not enforce this — it is checked once the last token has been read — but the spec has to say it, and help output has to show it.

§hide: bool§hide_default_value: bool§hide_env: bool§hide_env_values: bool§hide_possible_values: bool§hide_short_help: bool§hide_long_help: bool§conflicts: &'a [&'a str]

Entries that cannot be given alongside this positional.

§requires: &'a [&'a str]§required_if: &'a [&'a str]§required_if_eq: &'a [RequiredIfEq<'a>]§required_if_eq_all: &'a [RequiredIfEq<'a>]§required_unless: &'a [&'a str]§required_unless_all: &'a [&'a str]§var_min: Option<usize>§var_max: Option<usize>§delimiter: Option<char>

The character one word is split on to make several positional values.

§help_heading: Option<&'a str>

Heading to list this argument under in help output.

§complete: Option<fn(&CompleteCtx<'_>) -> Vec<Candidate<'static>>>

What answers for this argument when a shell asks. See FlagMeta::complete.

§complete_type: Option<&'a str>

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

Implementations§

Source§

impl ArgMeta<'_>

Source

pub const EMPTY: ArgMeta<'static>

Metadata for an argument with nothing declared, for struct update syntax.

Trait Implementations§

Source§

impl<'a> Clone for ArgMeta<'a>

Source§

fn clone(&self) -> ArgMeta<'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 ArgMeta<'a>

Source§

impl<'a> Debug for ArgMeta<'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 ArgMeta<'a>

§

impl<'a> RefUnwindSafe for ArgMeta<'a>

§

impl<'a> Send for ArgMeta<'a>

§

impl<'a> Sync for ArgMeta<'a>

§

impl<'a> Unpin for ArgMeta<'a>

§

impl<'a> UnsafeUnpin for ArgMeta<'a>

§

impl<'a> UnwindSafe for ArgMeta<'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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.