Trait parser_combinators::primitives::Parser
[−]
[src]
pub trait Parser {
type Input: Stream;
type Output;
fn parse_state(&mut self, input: State<Self::Input>) -> ParseResult<Self::Output, Self::Input, Self::Input::Item>;
fn parse(&mut self, input: Self::Input) -> Result<(Self::Output, Self::Input), ParseError<Self::Input::Item>> { ... }
}By implementing the Parser trait a type says that it can be used to parse an input stream into
the type Output.
Associated Types
type Input: Stream
A type implementing the Stream trait which is the specific type
that is parsed.
type Output
The type which is returned when the parsing is successful.
Required Methods
fn parse_state(&mut self, input: State<Self::Input>) -> ParseResult<Self::Output, Self::Input, Self::Input::Item>
Parses using the state input by calling Stream::uncons one or more times
On success returns Ok((value, new_state)) on failure it returns Err(error)
Provided Methods
fn parse(&mut self, input: Self::Input) -> Result<(Self::Output, Self::Input), ParseError<Self::Input::Item>>
Entrypoint of the parser
Takes some input and tries to parse it returning a ParseResult
Implementors
impl<'a, I, O, P: ?Sized> Parser for &'a mut P where I: Stream, P: Parser<Input=I, Output=O>impl<I, O, P: ?Sized> Parser for Box<P> where I: Stream, P: Parser<Input=I, Output=O>impl<I> Parser for Any<I> where I: Streamimpl<I, P> Parser for Satisfy<I, P> where I: Stream, P: FnMut(I::Item) -> boolimpl<I> Parser for Token<I> where I: Stream, I::Item: PartialEqimpl<I, O, S, P> Parser for Choice<S, P> where I: Stream, S: AsMut<[P]>, P: Parser<Input=I, Output=O>impl<I> Parser for Unexpected<I> where I: Streamimpl<I, T> Parser for Value<I, T> where I: Stream, T: Cloneimpl<P> Parser for NotFollowedBy<P> where P: Parserimpl<F, P> Parser for Many<F, P> where P: Parser, F: FromIterator<P::Output>impl<F, P> Parser for Many1<F, P> where F: FromIterator<P::Output>, P: Parserimpl<P> Parser for SkipMany<P> where P: Parserimpl<P> Parser for SkipMany1<P> where P: Parserimpl<F, P, S> Parser for SepBy<F, P, S> where F: FromIterator<P::Output>, P: Parser, S: Parser<Input=P::Input>impl<'a, I: Stream, O> Parser for FnMut(State<I>) -> ParseResult<O, I, I::Item> + 'aimpl<I, O, F> Parser for FnParser<I, F> where I: Stream, F: FnMut(State<I>) -> ParseResult<O, I, I::Item>impl<I, O> Parser for fn(State<I>) -> ParseResult<O, I, I::Item> where I: Streamimpl<P> Parser for Optional<P> where P: Parserimpl<L, R, P> Parser for Between<L, R, P> where L: Parser, R: Parser<Input=L::Input>, P: Parser<Input=L::Input>impl<I, O, P, Op> Parser for Chainl1<P, Op> where I: Stream, P: Parser<Input=I, Output=O>, Op: Parser<Input=I>, Op::Output: FnOnce(O, O) -> Oimpl<I, O, P, Op> Parser for Chainr1<P, Op> where I: Stream, P: Parser<Input=I, Output=O>, Op: Parser<Input=I>, Op::Output: FnOnce(O, O) -> Oimpl<I, O, P> Parser for Try<P> where I: Stream, P: Parser<Input=I, Output=O>impl<I, A, B, P1, P2> Parser for And<P1, P2> where I: Stream, P1: Parser<Input=I, Output=A>, P2: Parser<Input=I, Output=B>impl<I, P1, P2> Parser for With<P1, P2> where I: Stream, P1: Parser<Input=I>, P2: Parser<Input=I>impl<I, P1, P2> Parser for Skip<P1, P2> where I: Stream, P1: Parser<Input=I>, P2: Parser<Input=I>impl<I, P> Parser for Message<P> where I: Stream, P: Parser<Input=I>impl<I, O, P1, P2> Parser for Or<P1, P2> where I: Stream, P1: Parser<Input=I, Output=O>, P2: Parser<Input=I, Output=O>impl<I, A, B, P, F> Parser for Map<P, F> where I: Stream, P: Parser<Input=I, Output=A>, F: FnMut(A) -> Bimpl<P, N, F> Parser for Then<P, F> where F: FnMut(P::Output) -> N, P: Parser, N: Parser<Input=P::Input>impl<P> Parser for Expected<P> where P: Parserimpl<P, F, O, E> Parser for AndThen<P, F> where P: Parser, F: FnMut(P::Output) -> Result<O, E>, E: Into<Error<P::Input::Item>>impl<Input: Stream, A: Parser<Input=Input>, B: Parser<Input=Input>> Parser for (A, B)impl<Input: Stream, A: Parser<Input=Input>, B: Parser<Input=Input>, C: Parser<Input=Input>> Parser for (A, B, C)impl<Input: Stream, A: Parser<Input=Input>, B: Parser<Input=Input>, C: Parser<Input=Input>, D: Parser<Input=Input>> Parser for (A, B, C, D)impl<Input: Stream, A: Parser<Input=Input>, B: Parser<Input=Input>, C: Parser<Input=Input>, D: Parser<Input=Input>, E: Parser<Input=Input>> Parser for (A, B, C, D, E)impl<Input: Stream, A: Parser<Input=Input>, B: Parser<Input=Input>, C: Parser<Input=Input>, D: Parser<Input=Input>, E: Parser<Input=Input>, F: Parser<Input=Input>> Parser for (A, B, C, D, E, F)impl<Input: Stream, A: Parser<Input=Input>, B: Parser<Input=Input>, C: Parser<Input=Input>, D: Parser<Input=Input>, E: Parser<Input=Input>, F: Parser<Input=Input>, G: Parser<Input=Input>> Parser for (A, B, C, D, E, F, G)impl<Input: Stream, A: Parser<Input=Input>, B: Parser<Input=Input>, C: Parser<Input=Input>, D: Parser<Input=Input>, E: Parser<Input=Input>, F: Parser<Input=Input>, G: Parser<Input=Input>, H: Parser<Input=Input>> Parser for (A, B, C, D, E, F, G, H)impl<Input: Stream, A: Parser<Input=Input>, B: Parser<Input=Input>, C: Parser<Input=Input>, D: Parser<Input=Input>, E: Parser<Input=Input>, F: Parser<Input=Input>, G: Parser<Input=Input>, H: Parser<Input=Input>, I: Parser<Input=Input>> Parser for (A, B, C, D, E, F, G, H, I)impl<Input: Stream, A: Parser<Input=Input>, B: Parser<Input=Input>, C: Parser<Input=Input>, D: Parser<Input=Input>, E: Parser<Input=Input>, F: Parser<Input=Input>, G: Parser<Input=Input>, H: Parser<Input=Input>, I: Parser<Input=Input>, J: Parser<Input=Input>> Parser for (A, B, C, D, E, F, G, H, I, J)impl<Input: Stream, A: Parser<Input=Input>, B: Parser<Input=Input>, C: Parser<Input=Input>, D: Parser<Input=Input>, E: Parser<Input=Input>, F: Parser<Input=Input>, G: Parser<Input=Input>, H: Parser<Input=Input>, I: Parser<Input=Input>, J: Parser<Input=Input>, K: Parser<Input=Input>> Parser for (A, B, C, D, E, F, G, H, I, J, K)impl<Input: Stream, A: Parser<Input=Input>, B: Parser<Input=Input>, C: Parser<Input=Input>, D: Parser<Input=Input>, E: Parser<Input=Input>, F: Parser<Input=Input>, G: Parser<Input=Input>, H: Parser<Input=Input>, I: Parser<Input=Input>, J: Parser<Input=Input>, K: Parser<Input=Input>, L: Parser<Input=Input>> Parser for (A, B, C, D, E, F, G, H, I, J, K, L)impl<I> Parser for Digit<I> where I: Stream<Item=char>impl<I> Parser for Space<I> where I: Stream<Item=char>impl<I> Parser for Spaces<I> where I: Stream<Item=char>impl<I> Parser for NewLine<I> where I: Stream<Item=char>impl<I> Parser for CrLf<I> where I: Stream<Item=char>impl<I> Parser for Tab<I> where I: Stream<Item=char>impl<I> Parser for Upper<I> where I: Stream<Item=char>impl<I> Parser for Lower<I> where I: Stream<Item=char>impl<I> Parser for AlphaNum<I> where I: Stream<Item=char>impl<I> Parser for Letter<I> where I: Stream<Item=char>impl<I> Parser for OctDigit<I> where I: Stream<Item=char>impl<I> Parser for HexDigit<I> where I: Stream<Item=char>impl<I> Parser for String<I> where I: Stream<Item=char>