Parser

Trait Parser 

Source
pub trait Parser: Sized {
    type Item;

Show 13 methods // Required methods fn register_low_level( &self, ll: &mut LowLevelParser, ) -> Result<(), SpecError>; fn parse_low_level( &mut self, ll: &mut LowLevelParserOutput, ) -> Result<Self::Item, Box<dyn Error>>; fn update_help(&self, help: &mut Help); // Provided methods fn parse_args<A: IntoIterator<Item = String>>( self, program_name: String, args: A, ) -> Result<Self::Item, (Box<dyn Error>, SpentParser<Self>)> { ... } fn parse_env( self, ) -> Result<Self::Item, (Box<dyn Error>, SpentParser<Self>)> { ... } fn both<PU: Parser>(self, other: PU) -> Both<Self::Item, PU::Item, Self, PU> { ... } fn map<U, F: FnOnce(Self::Item) -> U>( self, f: F, ) -> Map<Self::Item, U, F, Self> { ... } fn with_help<N: IntoName>(self, name: N) -> WithHelp<Self::Item, Self> { ... } fn with_help_default(self) -> WithHelp<Self::Item, Self> { ... } fn with_default_general<T>(self, value: T) -> WithDefaultGeneral<T, Self> { ... } fn choose_at_most_one<O: Parser>(self, other: O) -> ChooseAtMostOne<Self, O> { ... } fn with_default_lazy_general<T, F: FnOnce() -> T>( self, f: F, ) -> WithDefaultLazyGeneral<T, F, Self> { ... } fn required_general<S: AsRef<str>>( self, error_message: S, ) -> RequiredGeneral<Self> { ... }
}

Required Associated Types§

Required Methods§

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)

Provided Methods§

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>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Parser for Extra

Source§

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

Source§

impl<T> Parser for SomeIf<T>

Source§

impl<T, F: FnOnce() -> T, P: Parser<Item = Option<T>>> Parser for WithDefaultLazyGeneral<T, F, P>

Source§

type Item = T

Source§

impl<T, P: Parser<Item = Option<T>>> Parser for RequiredGeneral<P>

Source§

type Item = T

Source§

impl<T, P: Parser<Item = Option<T>>> Parser for WithDefaultGeneral<T, P>

Source§

type Item = T

Source§

impl<T, PA: Parser<Item = Option<T>>, PB: Parser<Item = Option<T>>> Parser for ChooseAtMostOne<PA, PB>

Source§

impl<T, PT: Parser<Item = T>> Parser for WithHelp<T, PT>

Source§

impl<T, U, F: FnOnce(T) -> U, POT: ParserOpt<ItemOpt = T>> Parser for MapOpt<T, U, F, POT>

Source§

impl<T, U, F: FnOnce(T) -> U, PT: Parser<Item = T>> Parser for Map<T, U, F, PT>

Source§

type Item = U

Source§

impl<T, U, PT: Parser<Item = T>, PU: Parser<Item = U>> Parser for Both<T, U, PT, PU>

Source§

impl<V: FromStr, T: From<V>, D: DefaultValue<Item = T>> Parser for WithDefault<V, T, D>

Source§

type Item = T