Trait Param

Source
pub trait Param {
    type Item;
    type Error: Debug + Display;

    // Required methods
    fn update_options(&self, opts: &mut Options, notes: Notes);
    fn get(&self, matches: &Matches) -> Result<Self::Item, Self::Error>;
    fn name(&self) -> String;

    // Provided methods
    fn parse<C: IntoIterator>(
        &self,
        args: C,
        which_notes_to_document: WhichNotes,
    ) -> (Result<Self::Item, TopLevelError<Self::Error>>, Usage)
       where C::Item: AsRef<OsStr> { ... }
    fn parse_env(
        &self,
        which_notes_to_document: WhichNotes,
        program_name: ProgramName,
    ) -> (Result<Self::Item, TopLevelError<Self::Error>>, UsageWithProgramName) { ... }
    fn parse_env_default(
        &self,
    ) -> (Result<Self::Item, TopLevelError<Self::Error>>, UsageWithProgramName) { ... }
}

Required Associated Types§

Required Methods§

Source

fn update_options(&self, opts: &mut Options, notes: Notes)

Source

fn get(&self, matches: &Matches) -> Result<Self::Item, Self::Error>

Source

fn name(&self) -> String

Provided Methods§

Source

fn parse<C: IntoIterator>( &self, args: C, which_notes_to_document: WhichNotes, ) -> (Result<Self::Item, TopLevelError<Self::Error>>, Usage)
where C::Item: AsRef<OsStr>,

Source

fn parse_env( &self, which_notes_to_document: WhichNotes, program_name: ProgramName, ) -> (Result<Self::Item, TopLevelError<Self::Error>>, UsageWithProgramName)

Source

fn parse_env_default( &self, ) -> (Result<Self::Item, TopLevelError<Self::Error>>, UsageWithProgramName)

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 Param for Arg

Source§

impl Param for Flag

Source§

impl<A, B> Param for Join<A, B>
where A: Param, B: Param,

Source§

type Item = (<A as Param>::Item, <B as Param>::Item)

Source§

type Error = Either<<A as Param>::Error, <B as Param>::Error>

Source§

impl<A, F, U, E> Param for Convert<A, F>
where A: Param, A::Item: Clone + Debug + Display, E: Debug + Display, F: Fn(&A::Item) -> Result<U, E>,

Source§

type Item = U

Source§

type Error = ConvertError<<A as Param>::Error, <A as Param>::Item, E>

Source§

impl<A, T> Param for SomeIf<A, T>
where T: Clone, A: Param<Item = bool>,

Source§

type Item = Option<T>

Source§

type Error = <A as Param>::Error

Source§

impl<A, T, U, F> Param for OptMap<A, F>
where A: Param<Item = Option<T>>, F: Fn(T) -> U,

Source§

type Item = Option<U>

Source§

type Error = <A as Param>::Error

Source§

impl<A, U, E, F> Param for TryMap<A, F>
where A: Param, E: Debug + Display, F: Fn(A::Item) -> Result<U, E>,

Source§

type Item = U

Source§

type Error = TryMapError<<A as Param>::Error, E>

Source§

impl<A, U, F> Param for Map<A, F>
where A: Param, F: Fn(A::Item) -> U,

Source§

type Item = U

Source§

type Error = <A as Param>::Error

Source§

impl<P> Param for AddNote<P>
where P: Param,

Source§

type Item = <P as Param>::Item

Source§

type Error = <P as Param>::Error

Source§

impl<P> Param for Rename<P>
where P: Param,

Source§

type Item = <P as Param>::Item

Source§

type Error = <P as Param>::Error

Source§

impl<P> Param for SetNotesToDocument<P>
where P: Param,

Source§

type Item = <P as Param>::Item

Source§

type Error = <P as Param>::Error

Source§

impl<P, T> Param for Required<P>
where P: Param<Item = Option<T>>,

Source§

impl<P, T> Param for WithDefault<P, T>
where T: Clone + Display, P: Param<Item = Option<T>>,

Source§

type Item = T

Source§

type Error = <P as Param>::Error

Source§

impl<T> Param for Value<T>
where T: Clone,

Source§

impl<T, A, B> Param for EitherHomogeneous<A, B>
where A: Param<Item = Option<T>>, B: Param<Item = Option<T>>,

Source§

impl<T, A, U, E, F> Param for OptTryMap<A, F>
where A: Param<Item = Option<T>>, E: Debug + Display, F: Fn(T) -> Result<U, E>,

Source§

impl<T, A, U, F, E> Param for OptConvert<A, F>
where T: Clone + Debug + Display, E: Clone + Debug + Display, A: Param<Item = Option<T>>, F: Fn(T) -> Result<U, E>,

Source§

type Item = Option<U>

Source§

type Error = ConvertError<<A as Param>::Error, T, E>

Source§

impl<T, C, V> Param for Otherwise<C, V>
where C: Param<Item = Option<T>>, V: Param,

Source§

type Item = Either<T, <V as Param>::Item>

Source§

type Error = Either<<C as Param>::Error, <V as Param>::Error>

Source§

impl<T, U, A, B> Param for Codepend<A, B>
where A: Param<Item = Option<T>>, B: Param<Item = Option<U>>,

Source§

impl<T, U, A, B> Param for Either<A, B>
where A: Param<Item = Option<T>>, B: Param<Item = Option<U>>,

Source§

type Item = Option<Either<T, U>>

Source§

type Error = EitherError<<A as Param>::Error, <B as Param>::Error>

Source§

impl<V> Param for WithHelp<V>
where V: Param,

Source§

type Item = HelpOr<<V as Param>::Item>

Source§

type Error = <V as Param>::Error