pub trait Parse<'a>where
Self: Sized,{
// Required method
fn from_parser(p: &mut Parser<'a>) -> Result<Self, ParserError>;
// Provided method
fn parse(bytes: &'a [u8]) -> Result<Self, ParserError> { ... }
}
Expand description
Defines types that can parse from a byte stream
Required Methods§
Sourcefn from_parser(p: &mut Parser<'a>) -> Result<Self, ParserError>
fn from_parser(p: &mut Parser<'a>) -> Result<Self, ParserError>
Parses an instance of Self
from a Parser
.
This allows the caller to detect which bytes were not consumed at the end of the input.
Provided Methods§
Sourcefn parse(bytes: &'a [u8]) -> Result<Self, ParserError>
fn parse(bytes: &'a [u8]) -> Result<Self, ParserError>
Parses an instance of Self
from a byte slice.
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.