pub trait Leaf<'i>: Sized {
type Output;
// Required method
fn parse(&self, input: &'i [u8]) -> LeafResult<'i, Self::Output>;
}Expand description
Trait implemented by atomic, fail‑fast parsers.
Leaf parsers always return the first error they encounter without backtracking.
Required Associated Types§
Required Methods§
Sourcefn parse(&self, input: &'i [u8]) -> LeafResult<'i, Self::Output>
fn parse(&self, input: &'i [u8]) -> LeafResult<'i, Self::Output>
Parse one item, returning immediately on error without backtracking.
Returns a tuple of the successfully parsed Output value and the
remaining bytes, or a tuple containing a ParseError and the location of the error.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<'i> Leaf<'i> for &'static str
Matches the string literal exactly.
impl<'i> Leaf<'i> for &'static str
Matches the string literal exactly.
Normally used with with_prefix or with_suffix.
Source§impl<'i> Leaf<'i> for u8
Matches the byte exactly.
impl<'i> Leaf<'i> for u8
Matches the byte exactly.
Normally used with with_prefix or with_suffix.