pub struct ParseAny<T> {
pub(crate) metavar: Doc,
pub(crate) help: Option<Doc>,
pub(crate) check: Box<dyn Fn(OsString) -> Option<T>>,
pub(crate) anywhere: bool,
}Expand description
Fields§
§metavar: Doc§help: Option<Doc>§check: Box<dyn Fn(OsString) -> Option<T>>§anywhere: boolImplementations§
Source§impl<T> ParseAny<T>
impl<T> ParseAny<T>
pub(crate) fn item(&self) -> Item
Sourcepub fn metavar<M: Into<Doc>>(self, metavar: M) -> Self
pub fn metavar<M: Into<Doc>>(self, metavar: M) -> Self
Replace metavar with a custom value
See examples in any
Sourcepub fn anywhere(self) -> Self
pub fn anywhere(self) -> Self
Try to apply the parser to each unconsumed element instead of just the front one
By default any tries to parse just the front unconsumed item behaving similar to
positional parser, anywhere changes it so it applies to every unconsumed item,
similar to argument parser.
See examples in any
Trait Implementations§
Source§impl<T> Parser<T> for ParseAny<T>
impl<T> Parser<T> for ParseAny<T>
Source§fn collect<C>(self) -> ParseCollect<Self, C, T>where
C: FromIterator<T>,
Self: Sized,
fn collect<C>(self) -> ParseCollect<Self, C, T>where
C: FromIterator<T>,
Self: Sized,
Transform parser into a collection parser Read more
Source§fn optional(self) -> ParseOptional<Self>
fn optional(self) -> ParseOptional<Self>
Turn a required argument into an optional one Read more
Source§fn count(self) -> ParseCount<Self, T>
fn count(self) -> ParseCount<Self, T>
Count how many times the inner parser succeeds, and return that number. Read more
Source§fn last(self) -> ParseLast<Self>
fn last(self) -> ParseLast<Self>
Apply the inner parser as many times as it succeeds, return the last value Read more
Source§fn parse<F, R, E>(self, f: F) -> ParseWith<T, Self, F, E, R>
fn parse<F, R, E>(self, f: F) -> ParseWith<T, Self, F, E, R>
Apply a failing transformation to a contained value Read more
Source§fn map<F, R>(self, map: F) -> ParseMap<T, Self, F, R>
fn map<F, R>(self, map: F) -> ParseMap<T, Self, F, R>
Apply a pure transformation to a contained value Read more
Source§fn guard<F>(self, check: F, message: &'static str) -> ParseGuard<Self, F>
fn guard<F>(self, check: F, message: &'static str) -> ParseGuard<Self, F>
Validate or fail with a message Read more
Source§fn fallback(self, value: T) -> ParseFallback<Self, T>
fn fallback(self, value: T) -> ParseFallback<Self, T>
Use this value as default if the value isn’t present on a command line Read more
Source§fn fallback_with<F, E>(self, fallback: F) -> ParseFallbackWith<T, Self, F, E>
fn fallback_with<F, E>(self, fallback: F) -> ParseFallbackWith<T, Self, F, E>
Use value produced by this function as default if the value isn’t present Read more
Source§fn hide(self) -> ParseHide<Self>
fn hide(self) -> ParseHide<Self>
Ignore this parser during any sort of help generation Read more
Source§fn hide_usage(self) -> ParseUsage<Self>
fn hide_usage(self) -> ParseUsage<Self>
Ignore this parser when generating a usage line Read more
Source§fn custom_usage<M>(self, usage: M) -> ParseUsage<Self>
fn custom_usage<M>(self, usage: M) -> ParseUsage<Self>
Customize how this parser looks like in the usage line Read more
Source§fn group_help<M: Into<Doc>>(self, message: M) -> ParseGroupHelp<Self>
fn group_help<M: Into<Doc>>(self, message: M) -> ParseGroupHelp<Self>
Attach a help message to a complex parser Read more
Source§fn with_group_help<F>(self, f: F) -> ParseWithGroupHelp<Self, F>
fn with_group_help<F>(self, f: F) -> ParseWithGroupHelp<Self, F>
Source§fn to_options(self) -> OptionParser<T>
fn to_options(self) -> OptionParser<T>
Auto Trait Implementations§
impl<T> Freeze for ParseAny<T>
impl<T> !RefUnwindSafe for ParseAny<T>
impl<T> !Send for ParseAny<T>
impl<T> !Sync for ParseAny<T>
impl<T> Unpin for ParseAny<T>
impl<T> !UnwindSafe for ParseAny<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more