OptSpec

Struct OptSpec 

Source
pub struct OptSpec<'a, Ctx: ?Sized> { /* private fields */ }
Expand description

Option (flag or value-bearing).

Implementations§

Source§

impl<'a, Ctx: ?Sized> OptSpec<'a, Ctx>

Source

pub fn flag(name: &'a str, cb: OnFlag<Ctx>) -> Self

Create a flag option. Other fields are set via builder methods.

Source

pub const fn value(name: &'a str, cb: OnValue<Ctx>) -> Self

Create a value option. Other fields are set via builder methods.

Source

pub const fn short(self, s: char) -> Self

Source

pub const fn long(self, l: &'a str) -> Self

Source

pub const fn metavar(self, mv: &'a str) -> Self

Source

pub const fn help(self, h: &'a str) -> Self

Source

pub const fn env(self, name: &'a str) -> Self

Source

pub fn default(self, val: impl Into<OsString>) -> Self

Source

pub const fn group(self, g: &'a str) -> Self

Source

pub const fn single(self) -> Self

Source

pub const fn repeatable(self) -> Self

Source

pub const fn validator(self, v: ValueValidator) -> Self

Source

pub const fn get_name(&self) -> &str

Source

pub const fn get_short(&self) -> Option<char>

Source

pub const fn get_long(&self) -> Option<&str>

Source

pub const fn get_metavar(&self) -> Option<&str>

Source

pub const fn get_help(&self) -> Option<&str>

Source

pub const fn get_env(&self) -> Option<&str>

Source

pub const fn get_default(&self) -> Option<&OsString>

Source

pub const fn get_group(&self) -> Option<&str>

Source

pub const fn is_value(&self) -> bool

Source

pub const fn get_repeat(&self) -> Repeat

Source

pub fn get_on_value(&self) -> Option<OnValue<Ctx>>

Source

pub fn get_on_flag(&self) -> Option<OnFlag<Ctx>>

Source

pub fn get_validator(&self) -> Option<ValueValidator>

Auto Trait Implementations§

§

impl<'a, Ctx> Freeze for OptSpec<'a, Ctx>
where Ctx: ?Sized,

§

impl<'a, Ctx> RefUnwindSafe for OptSpec<'a, Ctx>
where Ctx: ?Sized,

§

impl<'a, Ctx> Send for OptSpec<'a, Ctx>
where Ctx: ?Sized,

§

impl<'a, Ctx> Sync for OptSpec<'a, Ctx>
where Ctx: ?Sized,

§

impl<'a, Ctx> Unpin for OptSpec<'a, Ctx>
where Ctx: ?Sized,

§

impl<'a, Ctx> UnwindSafe for OptSpec<'a, Ctx>
where Ctx: ?Sized,

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.