pub struct Digit<Input>where
<Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
Input: Stream + Stream<Token = char>,{ /* private fields */ }
Trait Implementations§
source§impl<Input> Clone for Digit<Input>where
<Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
Input: Stream + Stream<Token = char> + Clone,
impl<Input> Clone for Digit<Input>where
<Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
Input: Stream + Stream<Token = char> + Clone,
source§impl<Input> Parser<Input> for Digit<Input>where
<Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
Input: Stream + Stream<Token = char>,
impl<Input> Parser<Input> for Digit<Input>where
<Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
Input: Stream + Stream<Token = char>,
§type PartialState = ()
type PartialState = ()
Determines the state necessary to resume parsing after more input is supplied. Read more
source§fn add_error(&mut self, errors: &mut Tracked<<Input as StreamOnce>::Error>)
fn add_error(&mut self, errors: &mut Tracked<<Input as StreamOnce>::Error>)
Adds the first error that would normally be returned by this parser if it failed with an
PeekErr
result. Read moresource§fn parse(
&mut self,
input: Input
) -> Result<(Self::Output, Input), <Input as StreamOnce>::Error>
fn parse( &mut self, input: Input ) -> Result<(Self::Output, Input), <Input as StreamOnce>::Error>
Entry point of the parser. Takes some input and tries to parse it. Read more
source§fn parse_with_state(
&mut self,
input: &mut Input,
state: &mut Self::PartialState
) -> Result<Self::Output, <Input as StreamOnce>::Error>
fn parse_with_state( &mut self, input: &mut Input, state: &mut Self::PartialState ) -> Result<Self::Output, <Input as StreamOnce>::Error>
Entry point of the parser when using partial parsing.
Takes some input and tries to parse it. Read more
source§fn parse_stream(
&mut self,
input: &mut Input
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
fn parse_stream( &mut self, input: &mut Input ) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
source§fn parse_lazy(
&mut self,
input: &mut Input
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
fn parse_lazy( &mut self, input: &mut Input ) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
source§fn parse_stream_partial(
&mut self,
input: &mut Input,
state: &mut Self::PartialState
) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
fn parse_stream_partial( &mut self, input: &mut Input, state: &mut Self::PartialState ) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>
Like
parse_stream
but supports partial parsing.source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Borrows a parser instead of consuming it. Read more
source§fn with<P2>(self, p: P2) -> With<Self, P2>
fn with<P2>(self, p: P2) -> With<Self, P2>
Discards the value of the
self
parser and returns the value of p
.
Fails if any of the parsers fails. Read moresource§fn skip<P2>(self, p: P2) -> Skip<Self, P2>
fn skip<P2>(self, p: P2) -> Skip<Self, P2>
Discards the value of the
p
parser and returns the value of self
.
Fails if any of the parsers fails. Read moresource§fn and<P2>(self, p: P2) -> (Self, P2)
fn and<P2>(self, p: P2) -> (Self, P2)
Parses with
self
followed by p
.
Succeeds if both parsers succeed, otherwise fails.
Returns a tuple with both values on success. Read moresource§fn or<P2>(self, p: P2) -> Or<Self, P2>
fn or<P2>(self, p: P2) -> Or<Self, P2>
Returns a parser which attempts to parse using
self
. If self
fails without committing
it tries to consume the same input using p
. Read moresource§fn then<N, F>(self, f: F) -> Then<Self, F>
fn then<N, F>(self, f: F) -> Then<Self, F>
Parses using
self
and then passes the value to f
which returns a parser used to parse
the rest of the input. Read moresource§fn then_partial<N, F>(self, f: F) -> ThenPartial<Self, F>
fn then_partial<N, F>(self, f: F) -> ThenPartial<Self, F>
source§fn then_ref<N, F>(self, f: F) -> ThenRef<Self, F>
fn then_ref<N, F>(self, f: F) -> ThenRef<Self, F>
Parses using
self
and then passes a reference to the value to f
which returns a parser
used to parse the rest of the input. The value is then combined with the output of f
. Read morefn map_input<F, B>(self, f: F) -> MapInput<Self, F>
source§fn expected<S>(self, msg: S) -> Expected<Self, S>
fn expected<S>(self, msg: S) -> Expected<Self, S>
Parses with
self
and if it fails without consuming any input any expected errors are
replaced by msg
. msg
is then used in error messages as “Expected msg
”. Read moresource§fn silent(self) -> Silent<Self>where
Self: Sized,
fn silent(self) -> Silent<Self>where
Self: Sized,
Parses with
self
, if it fails without consuming any input any expected errors that would
otherwise be emitted by self
are suppressed. Read moresource§fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F>
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F>
Parses with
self
and applies f
on the result if self
parses successfully.
f
may optionally fail with an error which is automatically converted to a ParseError
. Read moresource§fn iter(
self,
input: &mut Input
) -> Iter<'_, Input, Self, Self::PartialState, FirstMode> ⓘ
fn iter( self, input: &mut Input ) -> Iter<'_, Input, Self, Self::PartialState, FirstMode> ⓘ
source§fn partial_iter<'a, 's, M>(
self,
mode: M,
input: &'a mut Input,
partial_state: &'s mut Self::PartialState
) -> Iter<'a, Input, Self, &'s mut Self::PartialState, M> ⓘ
fn partial_iter<'a, 's, M>( self, mode: M, input: &'a mut Input, partial_state: &'s mut Self::PartialState ) -> Iter<'a, Input, Self, &'s mut Self::PartialState, M> ⓘ
source§fn boxed<'a>(
self
) -> Box<dyn Parser<Input, Output = Self::Output, PartialState = Self::PartialState> + 'a>where
Self: Sized + 'a,
fn boxed<'a>(
self
) -> Box<dyn Parser<Input, Output = Self::Output, PartialState = Self::PartialState> + 'a>where
Self: Sized + 'a,
Available on crate feature
std
only.Turns the parser into a trait object by putting it in a
Box
. Can be used to easily
return parsers from functions without naming the type. Read moreimpl<Input> Copy for Digit<Input>where
<Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
Input: Stream + Stream<Token = char> + Copy,
Auto Trait Implementations§
impl<Input> Freeze for Digit<Input>
impl<Input> RefUnwindSafe for Digit<Input>
impl<Input> Send for Digit<Input>
impl<Input> Sync for Digit<Input>
impl<Input> Unpin for Digit<Input>
impl<Input> UnwindSafe for Digit<Input>
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
source§impl<Input, P> EasyParser<Input> for Pwhere
P: Parser<Stream<Input>> + ?Sized,
Input: Stream,
<Input as StreamOnce>::Token: PartialEq,
<Input as StreamOnce>::Range: PartialEq,
impl<Input, P> EasyParser<Input> for Pwhere
P: Parser<Stream<Input>> + ?Sized,
Input: Stream,
<Input as StreamOnce>::Token: PartialEq,
<Input as StreamOnce>::Range: PartialEq,
source§fn easy_parse(
&mut self,
input: Input
) -> Result<(<Self as Parser<Stream<Input>>>::Output, Input), ParseError<Input>>
fn easy_parse( &mut self, input: Input ) -> Result<(<Self as Parser<Stream<Input>>>::Output, Input), ParseError<Input>>
Available on crate feature
std
only.Entry point of the parser. Takes some input and tries to parse it, returning an easy to use
and format error if parsing did not succeed. Read more