Trait arg_combinators::Arg [−][src]
pub trait Arg { type Item; type Error: Debug + Display + Eq; fn update_options<O: Options>(&self, opts: &mut O); fn get(&self, matches: &Matches) -> Result<Self::Item, Self::Error>; fn name(&self) -> String; fn validate(&self) -> Option<Invalid> { ... } fn parse<I>(
&self,
args: I
) -> (Result<Self::Item, TopLevelError<Self::Error>>, Usage)
where
I: IntoIterator,
I::Item: AsRef<OsStr>, { ... } fn just_parse<I>(
&self,
args: I
) -> Result<Self::Item, TopLevelError<Self::Error>>
where
I: IntoIterator,
I::Item: AsRef<OsStr>, { ... } fn parse_env(
&self,
program_name: ProgramName
) -> (Result<Self::Item, TopLevelError<Self::Error>>, UsageWithProgramName) { ... } fn parse_env_default(
&self
) -> (Result<Self::Item, TopLevelError<Self::Error>>, UsageWithProgramName) { ... } fn map<U, F>(self, f: F) -> Map<Self, F>
where
F: Fn(Self::Item) -> U,
Self: Sized, { ... } fn try_map<U, E, F>(self, f: F) -> TryMap<Self, F>
where
E: Debug,
F: Fn(Self::Item) -> Result<U, E>,
Self: Sized, { ... } fn join<B>(self, b: B) -> Join<Self, B>
where
B: Arg,
Self: Sized, { ... } fn convert<F, U, E>(self, f: F) -> Convert<Self, F>
where
E: Debug + Display + Eq,
F: Fn(&Self::Item) -> Result<U, E>,
Self: Sized,
Self::Item: Clone + Debug, { ... } fn rename(self, name: String) -> Rename<Self>
where
Self: Sized, { ... } fn with_help(self, help: Flag) -> WithHelp<Self>
where
Self: Sized, { ... } fn with_default_help(self) -> WithHelp<Self>
where
Self: Sized, { ... } fn valid(self) -> Valid<Self>
where
Self: Sized, { ... } }
Associated Types
Required Methods
fn update_options<O: Options>(&self, opts: &mut O)
fn get(&self, matches: &Matches) -> Result<Self::Item, Self::Error>
fn name(&self) -> String
Provided Methods
fn validate(&self) -> Option<Invalid>
fn parse<I>(
&self,
args: I
) -> (Result<Self::Item, TopLevelError<Self::Error>>, Usage) where
I: IntoIterator,
I::Item: AsRef<OsStr>,
&self,
args: I
) -> (Result<Self::Item, TopLevelError<Self::Error>>, Usage) where
I: IntoIterator,
I::Item: AsRef<OsStr>,
fn just_parse<I>(
&self,
args: I
) -> Result<Self::Item, TopLevelError<Self::Error>> where
I: IntoIterator,
I::Item: AsRef<OsStr>,
&self,
args: I
) -> Result<Self::Item, TopLevelError<Self::Error>> where
I: IntoIterator,
I::Item: AsRef<OsStr>,
fn parse_env(
&self,
program_name: ProgramName
) -> (Result<Self::Item, TopLevelError<Self::Error>>, UsageWithProgramName)
&self,
program_name: ProgramName
) -> (Result<Self::Item, TopLevelError<Self::Error>>, UsageWithProgramName)
fn parse_env_default(
&self
) -> (Result<Self::Item, TopLevelError<Self::Error>>, UsageWithProgramName)
&self
) -> (Result<Self::Item, TopLevelError<Self::Error>>, UsageWithProgramName)
fn map<U, F>(self, f: F) -> Map<Self, F> where
F: Fn(Self::Item) -> U,
Self: Sized,
F: Fn(Self::Item) -> U,
Self: Sized,
fn try_map<U, E, F>(self, f: F) -> TryMap<Self, F> where
E: Debug,
F: Fn(Self::Item) -> Result<U, E>,
Self: Sized,
E: Debug,
F: Fn(Self::Item) -> Result<U, E>,
Self: Sized,
fn join<B>(self, b: B) -> Join<Self, B> where
B: Arg,
Self: Sized,
B: Arg,
Self: Sized,
fn convert<F, U, E>(self, f: F) -> Convert<Self, F> where
E: Debug + Display + Eq,
F: Fn(&Self::Item) -> Result<U, E>,
Self: Sized,
Self::Item: Clone + Debug,
E: Debug + Display + Eq,
F: Fn(&Self::Item) -> Result<U, E>,
Self: Sized,
Self::Item: Clone + Debug,
fn rename(self, name: String) -> Rename<Self> where
Self: Sized,
Self: Sized,
fn with_help(self, help: Flag) -> WithHelp<Self> where
Self: Sized,
Self: Sized,
fn with_default_help(self) -> WithHelp<Self> where
Self: Sized,
Self: Sized,
fn valid(self) -> Valid<Self> where
Self: Sized,
Self: Sized,
Implementors
impl<A, U, F> Arg for Map<A, F> where
A: Arg,
F: Fn(A::Item) -> U, type Item = U; type Error = A::Error;impl<V> Arg for WithHelp<V> where
V: Arg, type Item = HelpOr<V::Item>; type Error = V::Error;impl<T, C, V> Arg for Otherwise<C, V> where
C: Arg<Item = Option<T>>,
V: Arg, type Item = Either<T, V::Item>; type Error = Either<C::Error, V::Error>;impl<A, T> Arg for SomeIf<A, T> where
T: Clone,
A: Arg<Item = bool>, type Item = Option<T>; type Error = A::Error;impl<A, U, E, F> Arg for TryMap<A, F> where
A: Arg,
E: Debug + Display + Eq,
F: Fn(A::Item) -> Result<U, E>, type Item = U; type Error = ChildErrorOr<A::Error, E>;impl<A, T, U, F> Arg for OptionMap<A, F> where
A: Arg<Item = Option<T>>,
F: Fn(T) -> U, type Item = Option<U>; type Error = A::Error;impl<T, A, U, E, F> Arg for OptionTryMap<A, F> where
A: Arg<Item = Option<T>>,
E: Debug + Display + Eq,
F: Fn(T) -> Result<U, E>, type Item = Option<U>; type Error = ChildErrorOr<A::Error, E>;impl<A, B> Arg for Join<A, B> where
A: Arg,
B: Arg, type Item = (A::Item, B::Item); type Error = JoinError<A::Error, B::Error>;impl<T, U, A, B> Arg for OptionJoin<A, B> where
A: Arg<Item = Option<T>>,
B: Arg<Item = Option<U>>, type Item = Option<(T, U)>; type Error = OptionJoinError<A::Error, B::Error>;impl<T, U, A, B> Arg for EitherCombinator<A, B> where
A: Arg<Item = Option<T>>,
B: Arg<Item = Option<U>>, type Item = Option<Either<T, U>>; type Error = EitherError<A::Error, B::Error>;impl<T, A, B> Arg for EitherHomogeneous<A, B> where
A: Arg<Item = Option<T>>,
B: Arg<Item = Option<T>>, type Item = Option<T>; type Error = EitherError<A::Error, B::Error>;impl<P, T> Arg for WithDefault<P, T> where
T: Clone,
P: Arg<Item = Option<T>>, type Item = T; type Error = P::Error;impl<P, T> Arg for Required<P> where
P: Arg<Item = Option<T>>, type Item = T; type Error = RequiredError<P::Error>;impl<A, F, U, E> Arg for Convert<A, F> where
A: Arg,
A::Item: Clone + Debug + Display + Eq,
E: Debug + Display + Eq,
F: Fn(&A::Item) -> Result<U, E>, type Item = U; type Error = ConvertError<A::Error, A::Item, E>;impl<T, A, U, F, E> Arg for OptConvert<A, F> where
T: Clone + Debug + Display + Eq,
E: Clone + Debug + Display + Eq,
A: Arg<Item = Option<T>>,
F: Fn(T) -> Result<U, E>, type Item = Option<U>; type Error = ConvertError<A::Error, T, E>;impl<P> Arg for Rename<P> where
P: Arg, type Item = P::Item; type Error = P::Error;impl<T> Arg for Value<T> where
T: Clone, type Item = T; type Error = Never;impl<I, A> Arg for IterCombinator<A> where
I: IntoIterator,
A: Arg<Item = I>, type Item = I::IntoIter; type Error = A::Error;impl<'a, I, A, F, U, E> Arg for IterConvert<'a, A, F, U, E> where
I: Iterator,
A: Arg<Item = I>,
F: Fn(I::Item) -> Result<U, E>, type Item = Map<I, &'a F>; type Error = A::Error;impl<I, A, T, E> Arg for IterOkVec<A> where
E: Debug + Display + Eq,
I: Iterator<Item = Result<T, E>>,
A: Arg<Item = I>, type Item = Vec<T>; type Error = IterOkVecError<A::Error, E>;impl<A> Arg for Valid<A> where
A: Arg, type Item = A::Item; type Error = ChildErrorOr<A::Error, Invalid>;impl Arg for Opt type Item = Option<String>; type Error = Never;
impl Arg for Flag type Item = bool; type Error = Never;
impl Arg for MultiOpt type Item = Vec<String>; type Error = Never;
impl Arg for FreeArgs type Item = Vec<String>; type Error = Never;
impl Arg for MultiFlag type Item = usize; type Error = Never;
impl<A: Arg, D: Deref<Target = A>> Arg for D type Item = A::Item; type Error = A::Error;