Trait nommy::Parse[][src]

pub trait Parse<T>: Sized + Peek<T> {
    fn parse(input: &mut impl Buffer<T>) -> Result<Self>;
}

An interface for creating and composing parsers Takes in a Buffer iterator and consumes a subset of it, Returning Self if it managed to parse ok, otherwise returning a meaningful error Parse can be derived for some types

use nommy::{Parse, IntoBuf, text::Tag};
let mut buffer = ".".chars().into_buf();
Tag::<".">::parse(&mut buffer).unwrap();

Required methods

fn parse(input: &mut impl Buffer<T>) -> Result<Self>[src]

Parse the input buffer, returning Ok if the value could be parsed, Otherwise, returns a meaningful error

Errors

Will return an error if the parser fails to interpret the input at any point

Loading content...

Implementations on Foreign Types

impl<P: Parse<T>, T: Clone> Parse<T> for Option<P>[src]

Result is None if parsing P fails, otherwise, result is Some(p)

impl<P: Parse<T>, T: Clone> Parse<T> for Vec<P>[src]

Repeatedly attempts to parse P, Result is all successful attempts

impl<P: Parse<T>, T, const N: usize> Parse<T> for [P; N][src]

Parse P N times into [P; N], fails if any step fails

use nommy::{parse_terminated, text::Tag};
let _: [Tag<".">; 3] = parse_terminated("...".chars()).unwrap();
Loading content...

Implementors

impl Parse<char> for LineEnding[src]

impl Parse<char> for Space[src]

impl Parse<char> for WhiteSpace[src]

impl<P: Parse<T>, T: Clone> Parse<T> for Vec1<P>[src]

Repeatedly attempt to parse P, Result is all successful attempts Must parse P at least once

impl<const BYTES: &'static [u8]> Parse<u8> for nommy::bytes::AnyOf1<BYTES>[src]

impl<const BYTES: &'static [u8]> Parse<u8> for nommy::bytes::OneOf<BYTES>[src]

impl<const CHARS: &'static str> Parse<char> for nommy::text::AnyOf1<CHARS>[src]

impl<const CHARS: &'static str> Parse<char> for AnyOf<CHARS>[src]

impl<const CHARS: &'static str> Parse<char> for nommy::text::OneOf<CHARS>[src]

impl<const CHARS: &'static str> Parse<char> for WhileNot1<CHARS>[src]

impl<const TAG: &'static str> Parse<char> for nommy::text::Tag<TAG>[src]

impl<const TAG: &'static [u8]> Parse<u8> for nommy::bytes::Tag<TAG>[src]

Loading content...