Struct parsell::impls::Opt
[−]
[src]
pub struct Opt<P>(_);
Methods
impl<P> Opt<P>
[src]
fn new(parser: P) -> Self
Trait Implementations
impl<P: Debug> Debug for Opt<P>
[src]
impl<P: Clone> Clone for Opt<P>
[src]
fn clone(&self) -> Opt<P>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<P: Copy> Copy for Opt<P>
[src]
impl<P> Parser for Opt<P> where P: Parser
[src]
fn or_else<P>(self, other: P) -> OrElse<Self, P> where Self: Sized, P: Parser
Choice between parsers
fn and_then<P>(self, other: P) -> AndThen<Self, P> where Self: Sized, P: Parser
Sequencing with a committed parser
fn try_and_then<P>(self, other: P) -> Map<AndThen<Self, P>, TryZip> where Self: Sized, P: Parser
Sequencing with a committed parser (bubble any errors from this parser).
fn and_then_try<P>(self, other: P) -> Map<AndThen<Self, P>, ZipTry> where Self: Sized, P: Parser
Sequencing with a committed parser (bubble any errors from that parser).
fn try_and_then_try<P>(self, other: P) -> VariantMap<AndThen<Self, P>, TryZipTry> where Self: Sized, P: Parser
Sequencing with a committed parser (bubble any errors from either parser).
fn plus<F>(self, factory: F) -> Plus<Self, F> where Self: Sized, F: Factory
Iterate one or more times (returns an uncommitted parser).
fn star<F>(self, factory: F) -> Star<Self, F> where Self: Sized, F: Factory
Iterate zero or more times (returns a committed parser).
fn map<F>(self, f: F) -> Map<Self, F> where Self: Sized
Apply a function to the result
fn map2<F>(self, f: F) -> Map<Self, Function2<F>> where Self: Sized
Apply a 2-arguent function to the result
fn map3<F>(self, f: F) -> Map<Self, Function3<F>> where Self: Sized
Apply a 3-arguent function to the result
fn map4<F>(self, f: F) -> Map<Self, Function4<F>> where Self: Sized
Apply a 4-arguent function to the result
fn map5<F>(self, f: F) -> Map<Self, Function5<F>> where Self: Sized
Apply a 5-arguent function to the result
fn try_map<F>(self, f: F) -> Map<Self, Try<F>> where Self: Sized
Apply a function to the result (bubble any errors).
fn try_map2<F>(self, f: F) -> Map<Self, Try<Function2<F>>> where Self: Sized
Apply a 2-argument function to the result (bubble any errors).
fn try_map3<F>(self, f: F) -> Map<Self, Try<Function3<F>>> where Self: Sized
Apply a 3-argument function to the result (bubble any errors).
fn try_map4<F>(self, f: F) -> Map<Self, Try<Function4<F>>> where Self: Sized
Apply a 4-argument function to the result (bubble any errors).
fn try_map5<F>(self, f: F) -> Map<Self, Try<Function5<F>>> where Self: Sized
Apply a 5-argument function to the result (bubble any errors).
fn map_ref<F>(self, f: F) -> Map<Self, Dereference<F>> where Self: Sized
Apply a by-reference function to the result
fn variant_map<F>(self, f: F) -> VariantMap<Self, F> where Self: Sized
Apply a variant function to the result
fn discard_and_then<P>(self, other: P) -> VariantMap<AndThen<Discard<Self>, P>, Second> where Self: Sized, P: Parser
Sequencing, discard the output of the first parse
fn and_then_discard<P>(self, other: P) -> VariantMap<AndThen<Self, Discard<P>>, First> where Self: Sized, P: Parser
Sequencing, discard the output of the second parse
fn try_discard_and_then<P>(self, other: P) -> VariantMap<Map<AndThen<Map<Self, TryDiscard>, P>, TryZip>, Try<Second>> where Self: Sized, P: Parser
Sequencing, discard the output of the first parse, bubble errors from the first parser
fn and_then_try_discard<P>(self, other: P) -> VariantMap<Map<AndThen<Self, Map<P, TryDiscard>>, ZipTry>, Try<First>> where Self: Sized, P: Parser
Sequencing, discard the output of the second parse, bubble errors from the second parser
fn try_discard_and_then_try<P>(self, other: P) -> VariantMap<VariantMap<AndThen<Map<Self, TryDiscard>, P>, TryZipTry>, Try<Second>> where Self: Sized, P: Parser
Sequencing, discard the output of the first parse, bubble errors from either parser
fn try_and_then_try_discard<P>(self, other: P) -> VariantMap<VariantMap<AndThen<Self, Map<P, TryDiscard>>, TryZipTry>, Try<First>> where Self: Sized, P: Parser
Sequencing, discard the output of the second parse, bubble errors from either parser
fn opt(self) -> Opt<Self> where Self: Sized
Optional parse
fn try_opt(self) -> VariantMap<Opt<Self>, TryOpt> where Self: Sized
Optional parse
fn discard(self) -> Discard<Self> where Self: Sized
Discard the output
fn try_discard(self) -> Map<Self, TryDiscard> where Self: Sized
Discard the output, bubbling errors
fn boxed<F>(self, f: F) -> Boxed<Self, F> where Self: Sized
Box up this parser
fn in_state<State>(self, state: State) -> InState<Self, State> where Self: Sized
Set the state of this parser
fn buffer(self) -> Buffered<Self> where Self: Sized
A parser which produces its input. Read more
impl<P, Ch, Str, Output> Stateful<Ch, Str, Option<Output>> for Opt<P> where P: Stateful<Ch, Str, Output>
[src]
fn more(self, string: &mut Str) -> ParseResult<Self, Option<Output>>
Provides data to the parser. Read more
fn done(self) -> Option<Output>
Tells the parser that it will not receive any more data. Read more
fn last(self, string: &mut Str) -> Output where Self: Sized
Provides the last data to the parser. Read more
impl<P, Ch, Str> HasOutput<Ch, Str> for Opt<P> where P: HasOutput<Ch, Str>
[src]
impl<P, Ch, Str, Output> Uncommitted<Ch, Str, Option<Output>> for Opt<P> where Str: PeekableIterator, P: Uncommitted<Ch, Str, Output>
[src]
type State = Opt<P::State>
fn init(&self, string: &mut Str) -> Option<ParseResult<Self::State, Option<Output>>>
Parse a string of data.