parsy 0.2.1

An easy-to-use, efficient parser combinators library
Documentation
use crate::{Eaten, PResult, Parser, ParserInput};

#[derive(Clone)]
pub struct Start;

impl Start {
    #[allow(clippy::new_without_default)]
    pub fn new() -> Self {
        Self
    }
}

impl Parser<()> for Start {
    fn parse_inner(&self, input: &mut ParserInput) -> PResult<()> {
        if input.offset() == 0 {
            Ok(Eaten::ate(input.range(0), ()))
        } else {
            Err(input.range(0).custom_err("Expected start of input"))
        }
    }
}