Struct meap::parser::Arg

source ·
pub struct Arg<A: Arity, H: HasParam, N: NameType> { /* private fields */ }

Implementations§

source§

impl<A: Arity, H: HasParam, N: NameType> Arg<A, H, N>

source

pub fn new(arity: A, has_param: H, name_type: N) -> Self

source

pub fn desc<S: AsRef<str>>(self, description: S) -> Self

source§

impl<A: Arity, H: HasParam> Arg<A, H, Named>

source

pub fn name<N: IntoName>(self, name: N) -> Self

source§

impl Arg<Optional, No, Named>

source

pub fn some_if<T>(self, value: T) -> SomeIf<T>

source§

impl<V: FromStr, T: Display + From<V>> Arg<Optional, YesVia<V, T>, Named>

source

pub fn with_default(self, value: T) -> WithDefault<V, T, Display<T>>

source§

impl<V: FromStr, T: From<V>> Arg<Optional, YesVia<V, T>, Named>

source

pub fn with_default_lazy<F: FnOnce() -> T, D: AsRef<str>>( self, description: D, thunk: F ) -> WithDefault<V, T, Lazy<T, F>>

source

pub fn with_default_desc<D: AsRef<str>>( self, description: D, value: T ) -> WithDefault<V, T, Described<T>>

source

pub fn with_default_parse<S: AsRef<str>>( self, value: S ) -> WithDefault<V, T, Parsed<V, T>>

Trait Implementations§

source§

impl<A: Arity, H: HasParam, N: NameType> Parser for Arg<A, H, N>where Self: SingleArgParser + SingleArgParserHelp,

§

type Item = <Arg<A, H, N> as SingleArgParser>::SingleArgItem

source§

fn register_low_level(&self, ll: &mut LowLevelParser) -> Result<(), SpecError>

source§

fn parse_low_level( &mut self, ll: &mut LowLevelParserOutput ) -> Result<Self::Item, Box<dyn Error>>

source§

fn update_help(&self, help: &mut Help)

source§

fn parse_args<A: IntoIterator<Item = String>>( self, program_name: String, args: A ) -> Result<Self::Item, (Box<dyn Error>, SpentParser<Self>)>

source§

fn parse_env(self) -> Result<Self::Item, (Box<dyn Error>, SpentParser<Self>)>

source§

fn both<PU: Parser>(self, other: PU) -> Both<Self::Item, PU::Item, Self, PU>

source§

fn map<U, F: FnOnce(Self::Item) -> U>(self, f: F) -> Map<Self::Item, U, F, Self>

source§

fn with_help<N: IntoName>(self, name: N) -> WithHelp<Self::Item, Self>

source§

fn with_help_default(self) -> WithHelp<Self::Item, Self>

source§

fn with_default_general<T>(self, value: T) -> WithDefaultGeneral<T, Self>

source§

fn choose_at_most_one<O: Parser>(self, other: O) -> ChooseAtMostOne<Self, O>

source§

fn with_default_lazy_general<T, F: FnOnce() -> T>( self, f: F ) -> WithDefaultLazyGeneral<T, F, Self>

source§

fn required_general<S: AsRef<str>>( self, error_message: S ) -> RequiredGeneral<Self>

source§

impl<T, A: Arity, H: HasParam, N: NameType> ParserOpt for Arg<A, H, N>where Self: Parser<Item = Option<T>>,

§

type ItemOpt = T

source§

fn map_opt<U, F: FnOnce(Self::ItemOpt) -> U>( self, f: F ) -> MapOpt<Self::ItemOpt, U, F, Self>

source§

impl SingleArgParser for Arg<Multiple, No, Named>

source§

impl<V: FromStr, T: From<V>> SingleArgParser for Arg<Multiple, YesVia<V, T>, Named>

source§

impl<V: FromStr, T: From<V>> SingleArgParser for Arg<Multiple, YesVia<V, T>, Positional>

source§

impl SingleArgParser for Arg<Optional, No, Named>

source§

impl<V: FromStr, T: From<V>> SingleArgParser for Arg<Optional, YesVia<V, T>, Named>

source§

impl<V: FromStr, T: From<V>> SingleArgParser for Arg<Optional, YesVia<V, T>, Positional>

source§

impl<V: FromStr, T: From<V>> SingleArgParser for Arg<Required, YesVia<V, T>, Named>

source§

impl<V: FromStr, T: From<V>> SingleArgParser for Arg<Required, YesVia<V, T>, Positional>

source§

impl<A: Arity, H: HasParam> SingleArgParserHelp for Arg<A, H, Named>

source§

impl<V: FromStr, T: From<V>, A: Arity> SingleArgParserHelp for Arg<A, YesVia<V, T>, Positional>

Auto Trait Implementations§

§

impl<A, H, N> RefUnwindSafe for Arg<A, H, N>where A: RefUnwindSafe, H: RefUnwindSafe, N: RefUnwindSafe,

§

impl<A, H, N> Send for Arg<A, H, N>where A: Send, H: Send, N: Send,

§

impl<A, H, N> Sync for Arg<A, H, N>where A: Sync, H: Sync, N: Sync,

§

impl<A, H, N> Unpin for Arg<A, H, N>where A: Unpin, H: Unpin, N: Unpin,

§

impl<A, H, N> UnwindSafe for Arg<A, H, N>where A: UnwindSafe, H: UnwindSafe, N: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.