Struct Spec

Source
pub struct Spec<C> { /* private fields */ }
Expand description

Option/argument specification.

Implementations§

Source§

impl<C> Spec<C>

Source

pub fn is_capture_rest(&self) -> bool

Return a boolean indicating whether this arg spec is configured to capture all the remaining arguments.

Source

pub fn is_exit(&self) -> bool

Return boolean indicating whether this arg spec will abort the parser.

Source

pub fn is_opt(&self) -> bool

Return boolean indicating whether this arg spec represents an “option”.

“Options” come in two forms: short or long

Short options are in the form “”, like “-h”, “-f”.

Long options are in the form “”, like “–help”, –file“.

This function will return true for either form.

Source

pub fn is_pos(&self) -> bool

Return boolean indicating whether this arg is a positional argument.

Source

pub fn is_req(&self) -> bool

Source

pub fn is_hidden(&self) -> bool

Source

pub fn get_nargs(&self) -> usize

Source

pub fn req_args(&self) -> bool

Source

pub fn get_opts_usage_str(&self) -> String

Source

pub fn get_usage_str(&self) -> String

Generate a string that shows a representation of this argument specification suitable for use in a “Usage: “ string.

Required parameters are enclosed by ‘<’ and ‘>’ charcters. Optional parameters are enclossed by ‘[’ and ‘]’ characters.

Source

pub fn get_help_title_str(&self) -> String

Source

pub fn get_help_text(&self) -> &Vec<String>

Auto Trait Implementations§

§

impl<C> Freeze for Spec<C>

§

impl<C> RefUnwindSafe for Spec<C>

§

impl<C> Send for Spec<C>

§

impl<C> Sync for Spec<C>

§

impl<C> Unpin for Spec<C>

§

impl<C> UnwindSafe for Spec<C>

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> 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, 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.