Struct mentat_parser_utils::macros::KeywordMapParser
[−]
[src]
pub struct KeywordMapParser<T>(pub T);
Trait Implementations
impl<'a, Av, Bv> Parser for KeywordMapParser<((&'static str, Av), (&'static str, Bv))> where
Av: Parser<Input = Stream<'a>>,
Bv: Parser<Input = Stream<'a>>,
[src]
impl<'a, Av, Bv> Parser for KeywordMapParser<((&'static str, Av), (&'static str, Bv))> where
Av: Parser<Input = Stream<'a>>,
Bv: Parser<Input = Stream<'a>>,
type Input = Stream<'a>
The type which is taken as input for the parser. The type must implement the Stream
trait which allows the parser to read items from the type. Read more
type Output = (Option<Av::Output>, Option<Bv::Output>)
The type which is returned if the parser is successful.
fn parse_lazy(
&mut self,
input: Stream<'a>
) -> ConsumedResult<(Option<Av::Output>, Option<Bv::Output>), Stream<'a>>
[src]
fn parse_lazy(
&mut self,
input: Stream<'a>
) -> ConsumedResult<(Option<Av::Output>, Option<Bv::Output>), Stream<'a>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn parse(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Self::Input), ParseError<Self::Input>>
[src]
fn parse(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Self::Input), ParseError<Self::Input>>
Entry point of the parser. Takes some input and tries to parse it. Read more
fn parse_stream(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Consumed<Self::Input>), Consumed<ParseError<Self::Input>>>
[src]
fn parse_stream(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Consumed<Self::Input>), Consumed<ParseError<Self::Input>>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn parse_stream_consumed(
&mut self,
input: Self::Input
) -> FastResult<(Self::Output, Self::Input), ParseError<Self::Input>>
[src]
fn parse_stream_consumed(
&mut self,
input: Self::Input
) -> FastResult<(Self::Output, Self::Input), ParseError<Self::Input>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn add_error(&mut self, _error: &mut ParseError<Self::Input>)
[src]
fn add_error(&mut self, _error: &mut ParseError<Self::Input>)
Adds the first error that would normally be returned by this parser if it failed with an EmptyErr
result. Read more
fn by_ref(&mut self) -> &mut Self
[src]
fn by_ref(&mut self) -> &mut Self
Borrows a parser instead of consuming it. Read more
fn with<P2>(self, p: P2) -> With<Self, P2> where
P2: Parser<Input = Self::Input>,
[src]
fn with<P2>(self, p: P2) -> With<Self, P2> where
P2: Parser<Input = Self::Input>,
Discards the value of the self
parser and returns the value of p
. Fails if any of the parsers fails. Read more
fn skip<P2>(self, p: P2) -> Skip<Self, P2> where
P2: Parser<Input = Self::Input>,
[src]
fn skip<P2>(self, p: P2) -> Skip<Self, P2> where
P2: Parser<Input = Self::Input>,
Discards the value of the p
parser and returns the value of self
. Fails if any of the parsers fails. Read more
fn and<P2>(self, p: P2) -> (Self, P2) where
P2: Parser<Input = Self::Input>,
[src]
fn and<P2>(self, p: P2) -> (Self, P2) where
P2: Parser<Input = Self::Input>,
Parses with self
followed by p
. Succeeds if both parsers succeed, otherwise fails. Returns a tuple with both values on success. Read more
fn or<P2>(self, p: P2) -> Or<Self, P2> where
P2: Parser<Input = Self::Input, Output = Self::Output>,
[src]
fn or<P2>(self, p: P2) -> Or<Self, P2> where
P2: Parser<Input = Self::Input, Output = Self::Output>,
Returns a parser which attempts to parse using self
. If self
fails without consuming any input it tries to consume the same input using p
. Read more
fn then<N, F>(self, f: F) -> Then<Self, F> where
F: FnMut(Self::Output) -> N,
N: Parser<Input = Self::Input>,
[src]
fn then<N, F>(self, f: F) -> Then<Self, F> where
F: FnMut(Self::Output) -> N,
N: Parser<Input = Self::Input>,
Parses using self
and then passes the value to f
which returns a parser used to parse the rest of the input. Read more
fn map<F, B>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Output) -> B,
[src]
fn map<F, B>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Output) -> B,
Uses f
to map over the parsed value. Read more
fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F> where
F: FnMut(Self::Output) -> Result<B, ParseError<Self::Input>>,
[src]
fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F> where
F: FnMut(Self::Output) -> Result<B, ParseError<Self::Input>>,
Uses f
to map over the output of self
. If f
returns an error the parser fails. Read more
fn message<S>(self, msg: S) -> Message<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
[src]
fn message<S>(self, msg: S) -> Message<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
Parses with self
and if it fails, adds the message msg
to the error. Read more
fn expected<S>(self, msg: S) -> Expected<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
[src]
fn expected<S>(self, msg: S) -> Expected<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
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 more
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F> where
E: Into<Error<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
F: FnMut(Self::Output) -> Result<O, E>,
[src]
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F> where
E: Into<Error<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
F: FnMut(Self::Output) -> Result<O, E>,
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 more
fn iter(self, input: Self::Input) -> Iter<Self>
[src]
fn iter(self, input: Self::Input) -> Iter<Self>
Creates an iterator from a parser and a state. Can be used as an alternative to [many
] when collecting directly into a FromIterator
type is not desirable. Read more
fn boxed<'a>(
self
) -> Box<Parser<Input = Self::Input, Output = Self::Output> + 'a> where
Self: 'a,
[src]
fn boxed<'a>(
self
) -> Box<Parser<Input = Self::Input, Output = Self::Output> + 'a> where
Self: 'a,
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 more
impl<'a, Av, Bv, Cv> Parser for KeywordMapParser<((&'static str, Av), (&'static str, Bv), (&'static str, Cv))> where
Av: Parser<Input = Stream<'a>>,
Bv: Parser<Input = Stream<'a>>,
Cv: Parser<Input = Stream<'a>>,
[src]
impl<'a, Av, Bv, Cv> Parser for KeywordMapParser<((&'static str, Av), (&'static str, Bv), (&'static str, Cv))> where
Av: Parser<Input = Stream<'a>>,
Bv: Parser<Input = Stream<'a>>,
Cv: Parser<Input = Stream<'a>>,
type Input = Stream<'a>
The type which is taken as input for the parser. The type must implement the Stream
trait which allows the parser to read items from the type. Read more
type Output = (Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>)
The type which is returned if the parser is successful.
fn parse_lazy(
&mut self,
input: Stream<'a>
) -> ConsumedResult<(Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>), Stream<'a>>
[src]
fn parse_lazy(
&mut self,
input: Stream<'a>
) -> ConsumedResult<(Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>), Stream<'a>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn parse(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Self::Input), ParseError<Self::Input>>
[src]
fn parse(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Self::Input), ParseError<Self::Input>>
Entry point of the parser. Takes some input and tries to parse it. Read more
fn parse_stream(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Consumed<Self::Input>), Consumed<ParseError<Self::Input>>>
[src]
fn parse_stream(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Consumed<Self::Input>), Consumed<ParseError<Self::Input>>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn parse_stream_consumed(
&mut self,
input: Self::Input
) -> FastResult<(Self::Output, Self::Input), ParseError<Self::Input>>
[src]
fn parse_stream_consumed(
&mut self,
input: Self::Input
) -> FastResult<(Self::Output, Self::Input), ParseError<Self::Input>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn add_error(&mut self, _error: &mut ParseError<Self::Input>)
[src]
fn add_error(&mut self, _error: &mut ParseError<Self::Input>)
Adds the first error that would normally be returned by this parser if it failed with an EmptyErr
result. Read more
fn by_ref(&mut self) -> &mut Self
[src]
fn by_ref(&mut self) -> &mut Self
Borrows a parser instead of consuming it. Read more
fn with<P2>(self, p: P2) -> With<Self, P2> where
P2: Parser<Input = Self::Input>,
[src]
fn with<P2>(self, p: P2) -> With<Self, P2> where
P2: Parser<Input = Self::Input>,
Discards the value of the self
parser and returns the value of p
. Fails if any of the parsers fails. Read more
fn skip<P2>(self, p: P2) -> Skip<Self, P2> where
P2: Parser<Input = Self::Input>,
[src]
fn skip<P2>(self, p: P2) -> Skip<Self, P2> where
P2: Parser<Input = Self::Input>,
Discards the value of the p
parser and returns the value of self
. Fails if any of the parsers fails. Read more
fn and<P2>(self, p: P2) -> (Self, P2) where
P2: Parser<Input = Self::Input>,
[src]
fn and<P2>(self, p: P2) -> (Self, P2) where
P2: Parser<Input = Self::Input>,
Parses with self
followed by p
. Succeeds if both parsers succeed, otherwise fails. Returns a tuple with both values on success. Read more
fn or<P2>(self, p: P2) -> Or<Self, P2> where
P2: Parser<Input = Self::Input, Output = Self::Output>,
[src]
fn or<P2>(self, p: P2) -> Or<Self, P2> where
P2: Parser<Input = Self::Input, Output = Self::Output>,
Returns a parser which attempts to parse using self
. If self
fails without consuming any input it tries to consume the same input using p
. Read more
fn then<N, F>(self, f: F) -> Then<Self, F> where
F: FnMut(Self::Output) -> N,
N: Parser<Input = Self::Input>,
[src]
fn then<N, F>(self, f: F) -> Then<Self, F> where
F: FnMut(Self::Output) -> N,
N: Parser<Input = Self::Input>,
Parses using self
and then passes the value to f
which returns a parser used to parse the rest of the input. Read more
fn map<F, B>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Output) -> B,
[src]
fn map<F, B>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Output) -> B,
Uses f
to map over the parsed value. Read more
fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F> where
F: FnMut(Self::Output) -> Result<B, ParseError<Self::Input>>,
[src]
fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F> where
F: FnMut(Self::Output) -> Result<B, ParseError<Self::Input>>,
Uses f
to map over the output of self
. If f
returns an error the parser fails. Read more
fn message<S>(self, msg: S) -> Message<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
[src]
fn message<S>(self, msg: S) -> Message<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
Parses with self
and if it fails, adds the message msg
to the error. Read more
fn expected<S>(self, msg: S) -> Expected<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
[src]
fn expected<S>(self, msg: S) -> Expected<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
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 more
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F> where
E: Into<Error<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
F: FnMut(Self::Output) -> Result<O, E>,
[src]
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F> where
E: Into<Error<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
F: FnMut(Self::Output) -> Result<O, E>,
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 more
fn iter(self, input: Self::Input) -> Iter<Self>
[src]
fn iter(self, input: Self::Input) -> Iter<Self>
Creates an iterator from a parser and a state. Can be used as an alternative to [many
] when collecting directly into a FromIterator
type is not desirable. Read more
fn boxed<'a>(
self
) -> Box<Parser<Input = Self::Input, Output = Self::Output> + 'a> where
Self: 'a,
[src]
fn boxed<'a>(
self
) -> Box<Parser<Input = Self::Input, Output = Self::Output> + 'a> where
Self: 'a,
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 more
impl<'a, Av, Bv, Cv, Dv> Parser for KeywordMapParser<((&'static str, Av), (&'static str, Bv), (&'static str, Cv), (&'static str, Dv))> where
Av: Parser<Input = Stream<'a>>,
Bv: Parser<Input = Stream<'a>>,
Cv: Parser<Input = Stream<'a>>,
Dv: Parser<Input = Stream<'a>>,
[src]
impl<'a, Av, Bv, Cv, Dv> Parser for KeywordMapParser<((&'static str, Av), (&'static str, Bv), (&'static str, Cv), (&'static str, Dv))> where
Av: Parser<Input = Stream<'a>>,
Bv: Parser<Input = Stream<'a>>,
Cv: Parser<Input = Stream<'a>>,
Dv: Parser<Input = Stream<'a>>,
type Input = Stream<'a>
The type which is taken as input for the parser. The type must implement the Stream
trait which allows the parser to read items from the type. Read more
type Output = (Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>, Option<Dv::Output>)
The type which is returned if the parser is successful.
fn parse_lazy(
&mut self,
input: Stream<'a>
) -> ConsumedResult<(Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>, Option<Dv::Output>), Stream<'a>>
[src]
fn parse_lazy(
&mut self,
input: Stream<'a>
) -> ConsumedResult<(Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>, Option<Dv::Output>), Stream<'a>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn parse(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Self::Input), ParseError<Self::Input>>
[src]
fn parse(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Self::Input), ParseError<Self::Input>>
Entry point of the parser. Takes some input and tries to parse it. Read more
fn parse_stream(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Consumed<Self::Input>), Consumed<ParseError<Self::Input>>>
[src]
fn parse_stream(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Consumed<Self::Input>), Consumed<ParseError<Self::Input>>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn parse_stream_consumed(
&mut self,
input: Self::Input
) -> FastResult<(Self::Output, Self::Input), ParseError<Self::Input>>
[src]
fn parse_stream_consumed(
&mut self,
input: Self::Input
) -> FastResult<(Self::Output, Self::Input), ParseError<Self::Input>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn add_error(&mut self, _error: &mut ParseError<Self::Input>)
[src]
fn add_error(&mut self, _error: &mut ParseError<Self::Input>)
Adds the first error that would normally be returned by this parser if it failed with an EmptyErr
result. Read more
fn by_ref(&mut self) -> &mut Self
[src]
fn by_ref(&mut self) -> &mut Self
Borrows a parser instead of consuming it. Read more
fn with<P2>(self, p: P2) -> With<Self, P2> where
P2: Parser<Input = Self::Input>,
[src]
fn with<P2>(self, p: P2) -> With<Self, P2> where
P2: Parser<Input = Self::Input>,
Discards the value of the self
parser and returns the value of p
. Fails if any of the parsers fails. Read more
fn skip<P2>(self, p: P2) -> Skip<Self, P2> where
P2: Parser<Input = Self::Input>,
[src]
fn skip<P2>(self, p: P2) -> Skip<Self, P2> where
P2: Parser<Input = Self::Input>,
Discards the value of the p
parser and returns the value of self
. Fails if any of the parsers fails. Read more
fn and<P2>(self, p: P2) -> (Self, P2) where
P2: Parser<Input = Self::Input>,
[src]
fn and<P2>(self, p: P2) -> (Self, P2) where
P2: Parser<Input = Self::Input>,
Parses with self
followed by p
. Succeeds if both parsers succeed, otherwise fails. Returns a tuple with both values on success. Read more
fn or<P2>(self, p: P2) -> Or<Self, P2> where
P2: Parser<Input = Self::Input, Output = Self::Output>,
[src]
fn or<P2>(self, p: P2) -> Or<Self, P2> where
P2: Parser<Input = Self::Input, Output = Self::Output>,
Returns a parser which attempts to parse using self
. If self
fails without consuming any input it tries to consume the same input using p
. Read more
fn then<N, F>(self, f: F) -> Then<Self, F> where
F: FnMut(Self::Output) -> N,
N: Parser<Input = Self::Input>,
[src]
fn then<N, F>(self, f: F) -> Then<Self, F> where
F: FnMut(Self::Output) -> N,
N: Parser<Input = Self::Input>,
Parses using self
and then passes the value to f
which returns a parser used to parse the rest of the input. Read more
fn map<F, B>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Output) -> B,
[src]
fn map<F, B>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Output) -> B,
Uses f
to map over the parsed value. Read more
fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F> where
F: FnMut(Self::Output) -> Result<B, ParseError<Self::Input>>,
[src]
fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F> where
F: FnMut(Self::Output) -> Result<B, ParseError<Self::Input>>,
Uses f
to map over the output of self
. If f
returns an error the parser fails. Read more
fn message<S>(self, msg: S) -> Message<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
[src]
fn message<S>(self, msg: S) -> Message<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
Parses with self
and if it fails, adds the message msg
to the error. Read more
fn expected<S>(self, msg: S) -> Expected<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
[src]
fn expected<S>(self, msg: S) -> Expected<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
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 more
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F> where
E: Into<Error<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
F: FnMut(Self::Output) -> Result<O, E>,
[src]
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F> where
E: Into<Error<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
F: FnMut(Self::Output) -> Result<O, E>,
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 more
fn iter(self, input: Self::Input) -> Iter<Self>
[src]
fn iter(self, input: Self::Input) -> Iter<Self>
Creates an iterator from a parser and a state. Can be used as an alternative to [many
] when collecting directly into a FromIterator
type is not desirable. Read more
fn boxed<'a>(
self
) -> Box<Parser<Input = Self::Input, Output = Self::Output> + 'a> where
Self: 'a,
[src]
fn boxed<'a>(
self
) -> Box<Parser<Input = Self::Input, Output = Self::Output> + 'a> where
Self: 'a,
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 more
impl<'a, Av, Bv, Cv, Dv, Ev> Parser for KeywordMapParser<((&'static str, Av), (&'static str, Bv), (&'static str, Cv), (&'static str, Dv), (&'static str, Ev))> where
Av: Parser<Input = Stream<'a>>,
Bv: Parser<Input = Stream<'a>>,
Cv: Parser<Input = Stream<'a>>,
Dv: Parser<Input = Stream<'a>>,
Ev: Parser<Input = Stream<'a>>,
[src]
impl<'a, Av, Bv, Cv, Dv, Ev> Parser for KeywordMapParser<((&'static str, Av), (&'static str, Bv), (&'static str, Cv), (&'static str, Dv), (&'static str, Ev))> where
Av: Parser<Input = Stream<'a>>,
Bv: Parser<Input = Stream<'a>>,
Cv: Parser<Input = Stream<'a>>,
Dv: Parser<Input = Stream<'a>>,
Ev: Parser<Input = Stream<'a>>,
type Input = Stream<'a>
The type which is taken as input for the parser. The type must implement the Stream
trait which allows the parser to read items from the type. Read more
type Output = (Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>, Option<Dv::Output>, Option<Ev::Output>)
The type which is returned if the parser is successful.
fn parse_lazy(
&mut self,
input: Stream<'a>
) -> ConsumedResult<(Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>, Option<Dv::Output>, Option<Ev::Output>), Stream<'a>>
[src]
fn parse_lazy(
&mut self,
input: Stream<'a>
) -> ConsumedResult<(Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>, Option<Dv::Output>, Option<Ev::Output>), Stream<'a>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn parse(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Self::Input), ParseError<Self::Input>>
[src]
fn parse(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Self::Input), ParseError<Self::Input>>
Entry point of the parser. Takes some input and tries to parse it. Read more
fn parse_stream(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Consumed<Self::Input>), Consumed<ParseError<Self::Input>>>
[src]
fn parse_stream(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Consumed<Self::Input>), Consumed<ParseError<Self::Input>>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn parse_stream_consumed(
&mut self,
input: Self::Input
) -> FastResult<(Self::Output, Self::Input), ParseError<Self::Input>>
[src]
fn parse_stream_consumed(
&mut self,
input: Self::Input
) -> FastResult<(Self::Output, Self::Input), ParseError<Self::Input>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn add_error(&mut self, _error: &mut ParseError<Self::Input>)
[src]
fn add_error(&mut self, _error: &mut ParseError<Self::Input>)
Adds the first error that would normally be returned by this parser if it failed with an EmptyErr
result. Read more
fn by_ref(&mut self) -> &mut Self
[src]
fn by_ref(&mut self) -> &mut Self
Borrows a parser instead of consuming it. Read more
fn with<P2>(self, p: P2) -> With<Self, P2> where
P2: Parser<Input = Self::Input>,
[src]
fn with<P2>(self, p: P2) -> With<Self, P2> where
P2: Parser<Input = Self::Input>,
Discards the value of the self
parser and returns the value of p
. Fails if any of the parsers fails. Read more
fn skip<P2>(self, p: P2) -> Skip<Self, P2> where
P2: Parser<Input = Self::Input>,
[src]
fn skip<P2>(self, p: P2) -> Skip<Self, P2> where
P2: Parser<Input = Self::Input>,
Discards the value of the p
parser and returns the value of self
. Fails if any of the parsers fails. Read more
fn and<P2>(self, p: P2) -> (Self, P2) where
P2: Parser<Input = Self::Input>,
[src]
fn and<P2>(self, p: P2) -> (Self, P2) where
P2: Parser<Input = Self::Input>,
Parses with self
followed by p
. Succeeds if both parsers succeed, otherwise fails. Returns a tuple with both values on success. Read more
fn or<P2>(self, p: P2) -> Or<Self, P2> where
P2: Parser<Input = Self::Input, Output = Self::Output>,
[src]
fn or<P2>(self, p: P2) -> Or<Self, P2> where
P2: Parser<Input = Self::Input, Output = Self::Output>,
Returns a parser which attempts to parse using self
. If self
fails without consuming any input it tries to consume the same input using p
. Read more
fn then<N, F>(self, f: F) -> Then<Self, F> where
F: FnMut(Self::Output) -> N,
N: Parser<Input = Self::Input>,
[src]
fn then<N, F>(self, f: F) -> Then<Self, F> where
F: FnMut(Self::Output) -> N,
N: Parser<Input = Self::Input>,
Parses using self
and then passes the value to f
which returns a parser used to parse the rest of the input. Read more
fn map<F, B>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Output) -> B,
[src]
fn map<F, B>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Output) -> B,
Uses f
to map over the parsed value. Read more
fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F> where
F: FnMut(Self::Output) -> Result<B, ParseError<Self::Input>>,
[src]
fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F> where
F: FnMut(Self::Output) -> Result<B, ParseError<Self::Input>>,
Uses f
to map over the output of self
. If f
returns an error the parser fails. Read more
fn message<S>(self, msg: S) -> Message<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
[src]
fn message<S>(self, msg: S) -> Message<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
Parses with self
and if it fails, adds the message msg
to the error. Read more
fn expected<S>(self, msg: S) -> Expected<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
[src]
fn expected<S>(self, msg: S) -> Expected<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
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 more
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F> where
E: Into<Error<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
F: FnMut(Self::Output) -> Result<O, E>,
[src]
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F> where
E: Into<Error<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
F: FnMut(Self::Output) -> Result<O, E>,
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 more
fn iter(self, input: Self::Input) -> Iter<Self>
[src]
fn iter(self, input: Self::Input) -> Iter<Self>
Creates an iterator from a parser and a state. Can be used as an alternative to [many
] when collecting directly into a FromIterator
type is not desirable. Read more
fn boxed<'a>(
self
) -> Box<Parser<Input = Self::Input, Output = Self::Output> + 'a> where
Self: 'a,
[src]
fn boxed<'a>(
self
) -> Box<Parser<Input = Self::Input, Output = Self::Output> + 'a> where
Self: 'a,
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 more
impl<'a, Av, Bv, Cv, Dv, Ev, Fv> Parser for KeywordMapParser<((&'static str, Av), (&'static str, Bv), (&'static str, Cv), (&'static str, Dv), (&'static str, Ev), (&'static str, Fv))> where
Av: Parser<Input = Stream<'a>>,
Bv: Parser<Input = Stream<'a>>,
Cv: Parser<Input = Stream<'a>>,
Dv: Parser<Input = Stream<'a>>,
Ev: Parser<Input = Stream<'a>>,
Fv: Parser<Input = Stream<'a>>,
[src]
impl<'a, Av, Bv, Cv, Dv, Ev, Fv> Parser for KeywordMapParser<((&'static str, Av), (&'static str, Bv), (&'static str, Cv), (&'static str, Dv), (&'static str, Ev), (&'static str, Fv))> where
Av: Parser<Input = Stream<'a>>,
Bv: Parser<Input = Stream<'a>>,
Cv: Parser<Input = Stream<'a>>,
Dv: Parser<Input = Stream<'a>>,
Ev: Parser<Input = Stream<'a>>,
Fv: Parser<Input = Stream<'a>>,
type Input = Stream<'a>
The type which is taken as input for the parser. The type must implement the Stream
trait which allows the parser to read items from the type. Read more
type Output = (Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>, Option<Dv::Output>, Option<Ev::Output>, Option<Fv::Output>)
The type which is returned if the parser is successful.
fn parse_lazy(
&mut self,
input: Stream<'a>
) -> ConsumedResult<(Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>, Option<Dv::Output>, Option<Ev::Output>, Option<Fv::Output>), Stream<'a>>
[src]
fn parse_lazy(
&mut self,
input: Stream<'a>
) -> ConsumedResult<(Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>, Option<Dv::Output>, Option<Ev::Output>, Option<Fv::Output>), Stream<'a>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn parse(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Self::Input), ParseError<Self::Input>>
[src]
fn parse(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Self::Input), ParseError<Self::Input>>
Entry point of the parser. Takes some input and tries to parse it. Read more
fn parse_stream(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Consumed<Self::Input>), Consumed<ParseError<Self::Input>>>
[src]
fn parse_stream(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Consumed<Self::Input>), Consumed<ParseError<Self::Input>>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn parse_stream_consumed(
&mut self,
input: Self::Input
) -> FastResult<(Self::Output, Self::Input), ParseError<Self::Input>>
[src]
fn parse_stream_consumed(
&mut self,
input: Self::Input
) -> FastResult<(Self::Output, Self::Input), ParseError<Self::Input>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn add_error(&mut self, _error: &mut ParseError<Self::Input>)
[src]
fn add_error(&mut self, _error: &mut ParseError<Self::Input>)
Adds the first error that would normally be returned by this parser if it failed with an EmptyErr
result. Read more
fn by_ref(&mut self) -> &mut Self
[src]
fn by_ref(&mut self) -> &mut Self
Borrows a parser instead of consuming it. Read more
fn with<P2>(self, p: P2) -> With<Self, P2> where
P2: Parser<Input = Self::Input>,
[src]
fn with<P2>(self, p: P2) -> With<Self, P2> where
P2: Parser<Input = Self::Input>,
Discards the value of the self
parser and returns the value of p
. Fails if any of the parsers fails. Read more
fn skip<P2>(self, p: P2) -> Skip<Self, P2> where
P2: Parser<Input = Self::Input>,
[src]
fn skip<P2>(self, p: P2) -> Skip<Self, P2> where
P2: Parser<Input = Self::Input>,
Discards the value of the p
parser and returns the value of self
. Fails if any of the parsers fails. Read more
fn and<P2>(self, p: P2) -> (Self, P2) where
P2: Parser<Input = Self::Input>,
[src]
fn and<P2>(self, p: P2) -> (Self, P2) where
P2: Parser<Input = Self::Input>,
Parses with self
followed by p
. Succeeds if both parsers succeed, otherwise fails. Returns a tuple with both values on success. Read more
fn or<P2>(self, p: P2) -> Or<Self, P2> where
P2: Parser<Input = Self::Input, Output = Self::Output>,
[src]
fn or<P2>(self, p: P2) -> Or<Self, P2> where
P2: Parser<Input = Self::Input, Output = Self::Output>,
Returns a parser which attempts to parse using self
. If self
fails without consuming any input it tries to consume the same input using p
. Read more
fn then<N, F>(self, f: F) -> Then<Self, F> where
F: FnMut(Self::Output) -> N,
N: Parser<Input = Self::Input>,
[src]
fn then<N, F>(self, f: F) -> Then<Self, F> where
F: FnMut(Self::Output) -> N,
N: Parser<Input = Self::Input>,
Parses using self
and then passes the value to f
which returns a parser used to parse the rest of the input. Read more
fn map<F, B>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Output) -> B,
[src]
fn map<F, B>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Output) -> B,
Uses f
to map over the parsed value. Read more
fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F> where
F: FnMut(Self::Output) -> Result<B, ParseError<Self::Input>>,
[src]
fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F> where
F: FnMut(Self::Output) -> Result<B, ParseError<Self::Input>>,
Uses f
to map over the output of self
. If f
returns an error the parser fails. Read more
fn message<S>(self, msg: S) -> Message<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
[src]
fn message<S>(self, msg: S) -> Message<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
Parses with self
and if it fails, adds the message msg
to the error. Read more
fn expected<S>(self, msg: S) -> Expected<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
[src]
fn expected<S>(self, msg: S) -> Expected<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
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 more
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F> where
E: Into<Error<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
F: FnMut(Self::Output) -> Result<O, E>,
[src]
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F> where
E: Into<Error<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
F: FnMut(Self::Output) -> Result<O, E>,
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 more
fn iter(self, input: Self::Input) -> Iter<Self>
[src]
fn iter(self, input: Self::Input) -> Iter<Self>
Creates an iterator from a parser and a state. Can be used as an alternative to [many
] when collecting directly into a FromIterator
type is not desirable. Read more
fn boxed<'a>(
self
) -> Box<Parser<Input = Self::Input, Output = Self::Output> + 'a> where
Self: 'a,
[src]
fn boxed<'a>(
self
) -> Box<Parser<Input = Self::Input, Output = Self::Output> + 'a> where
Self: 'a,
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 more
impl<'a, Av, Bv, Cv, Dv, Ev, Fv, Gv> Parser for KeywordMapParser<((&'static str, Av), (&'static str, Bv), (&'static str, Cv), (&'static str, Dv), (&'static str, Ev), (&'static str, Fv), (&'static str, Gv))> where
Av: Parser<Input = Stream<'a>>,
Bv: Parser<Input = Stream<'a>>,
Cv: Parser<Input = Stream<'a>>,
Dv: Parser<Input = Stream<'a>>,
Ev: Parser<Input = Stream<'a>>,
Fv: Parser<Input = Stream<'a>>,
Gv: Parser<Input = Stream<'a>>,
[src]
impl<'a, Av, Bv, Cv, Dv, Ev, Fv, Gv> Parser for KeywordMapParser<((&'static str, Av), (&'static str, Bv), (&'static str, Cv), (&'static str, Dv), (&'static str, Ev), (&'static str, Fv), (&'static str, Gv))> where
Av: Parser<Input = Stream<'a>>,
Bv: Parser<Input = Stream<'a>>,
Cv: Parser<Input = Stream<'a>>,
Dv: Parser<Input = Stream<'a>>,
Ev: Parser<Input = Stream<'a>>,
Fv: Parser<Input = Stream<'a>>,
Gv: Parser<Input = Stream<'a>>,
type Input = Stream<'a>
The type which is taken as input for the parser. The type must implement the Stream
trait which allows the parser to read items from the type. Read more
type Output = (Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>, Option<Dv::Output>, Option<Ev::Output>, Option<Fv::Output>, Option<Gv::Output>)
The type which is returned if the parser is successful.
fn parse_lazy(
&mut self,
input: Stream<'a>
) -> ConsumedResult<(Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>, Option<Dv::Output>, Option<Ev::Output>, Option<Fv::Output>, Option<Gv::Output>), Stream<'a>>
[src]
fn parse_lazy(
&mut self,
input: Stream<'a>
) -> ConsumedResult<(Option<Av::Output>, Option<Bv::Output>, Option<Cv::Output>, Option<Dv::Output>, Option<Ev::Output>, Option<Fv::Output>, Option<Gv::Output>), Stream<'a>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn parse(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Self::Input), ParseError<Self::Input>>
[src]
fn parse(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Self::Input), ParseError<Self::Input>>
Entry point of the parser. Takes some input and tries to parse it. Read more
fn parse_stream(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Consumed<Self::Input>), Consumed<ParseError<Self::Input>>>
[src]
fn parse_stream(
&mut self,
input: Self::Input
) -> Result<(Self::Output, Consumed<Self::Input>), Consumed<ParseError<Self::Input>>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn parse_stream_consumed(
&mut self,
input: Self::Input
) -> FastResult<(Self::Output, Self::Input), ParseError<Self::Input>>
[src]
fn parse_stream_consumed(
&mut self,
input: Self::Input
) -> FastResult<(Self::Output, Self::Input), ParseError<Self::Input>>
Parses using the stream input
by calling [Stream::uncons
] one or more times. Read more
fn add_error(&mut self, _error: &mut ParseError<Self::Input>)
[src]
fn add_error(&mut self, _error: &mut ParseError<Self::Input>)
Adds the first error that would normally be returned by this parser if it failed with an EmptyErr
result. Read more
fn by_ref(&mut self) -> &mut Self
[src]
fn by_ref(&mut self) -> &mut Self
Borrows a parser instead of consuming it. Read more
fn with<P2>(self, p: P2) -> With<Self, P2> where
P2: Parser<Input = Self::Input>,
[src]
fn with<P2>(self, p: P2) -> With<Self, P2> where
P2: Parser<Input = Self::Input>,
Discards the value of the self
parser and returns the value of p
. Fails if any of the parsers fails. Read more
fn skip<P2>(self, p: P2) -> Skip<Self, P2> where
P2: Parser<Input = Self::Input>,
[src]
fn skip<P2>(self, p: P2) -> Skip<Self, P2> where
P2: Parser<Input = Self::Input>,
Discards the value of the p
parser and returns the value of self
. Fails if any of the parsers fails. Read more
fn and<P2>(self, p: P2) -> (Self, P2) where
P2: Parser<Input = Self::Input>,
[src]
fn and<P2>(self, p: P2) -> (Self, P2) where
P2: Parser<Input = Self::Input>,
Parses with self
followed by p
. Succeeds if both parsers succeed, otherwise fails. Returns a tuple with both values on success. Read more
fn or<P2>(self, p: P2) -> Or<Self, P2> where
P2: Parser<Input = Self::Input, Output = Self::Output>,
[src]
fn or<P2>(self, p: P2) -> Or<Self, P2> where
P2: Parser<Input = Self::Input, Output = Self::Output>,
Returns a parser which attempts to parse using self
. If self
fails without consuming any input it tries to consume the same input using p
. Read more
fn then<N, F>(self, f: F) -> Then<Self, F> where
F: FnMut(Self::Output) -> N,
N: Parser<Input = Self::Input>,
[src]
fn then<N, F>(self, f: F) -> Then<Self, F> where
F: FnMut(Self::Output) -> N,
N: Parser<Input = Self::Input>,
Parses using self
and then passes the value to f
which returns a parser used to parse the rest of the input. Read more
fn map<F, B>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Output) -> B,
[src]
fn map<F, B>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Output) -> B,
Uses f
to map over the parsed value. Read more
fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F> where
F: FnMut(Self::Output) -> Result<B, ParseError<Self::Input>>,
[src]
fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F> where
F: FnMut(Self::Output) -> Result<B, ParseError<Self::Input>>,
Uses f
to map over the output of self
. If f
returns an error the parser fails. Read more
fn message<S>(self, msg: S) -> Message<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
[src]
fn message<S>(self, msg: S) -> Message<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
Parses with self
and if it fails, adds the message msg
to the error. Read more
fn expected<S>(self, msg: S) -> Expected<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
[src]
fn expected<S>(self, msg: S) -> Expected<Self> where
S: Into<Info<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
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 more
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F> where
E: Into<Error<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
F: FnMut(Self::Output) -> Result<O, E>,
[src]
fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F> where
E: Into<Error<<Self::Input as StreamOnce>::Item, <Self::Input as StreamOnce>::Range>>,
F: FnMut(Self::Output) -> Result<O, E>,
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 more
fn iter(self, input: Self::Input) -> Iter<Self>
[src]
fn iter(self, input: Self::Input) -> Iter<Self>
Creates an iterator from a parser and a state. Can be used as an alternative to [many
] when collecting directly into a FromIterator
type is not desirable. Read more
fn boxed<'a>(
self
) -> Box<Parser<Input = Self::Input, Output = Self::Output> + 'a> where
Self: 'a,
[src]
fn boxed<'a>(
self
) -> Box<Parser<Input = Self::Input, Output = Self::Output> + 'a> where
Self: 'a,
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 more
Auto Trait Implementations
impl<T> Send for KeywordMapParser<T> where
T: Send,
impl<T> Send for KeywordMapParser<T> where
T: Send,
impl<T> Sync for KeywordMapParser<T> where
T: Sync,
impl<T> Sync for KeywordMapParser<T> where
T: Sync,