pub trait Parse<'source>: Sized {
// Required method
fn std_parse(
input: &mut Parser<'source>,
recoverable_errors: &mut Vec<Error>,
) -> Result<Self, Vec<Error>>;
// Provided method
fn parse(input: &mut Parser<'source>) -> ParseResult<Self> { ... }
}Expand description
Any type that can be parsed from a source of tokens.
Required Methods§
Sourcefn std_parse(
input: &mut Parser<'source>,
recoverable_errors: &mut Vec<Error>,
) -> Result<Self, Vec<Error>>
fn std_parse( input: &mut Parser<'source>, recoverable_errors: &mut Vec<Error>, ) -> Result<Self, Vec<Error>>
Parses a value from the given stream of tokens, advancing the stream past the consumed tokens if parsing is successful.
If any recoverable errors are encountered, they should be appended to the given Vec,
and parsing should continue as normal. If an unrecoverable error is encountered, parsing
should abort with said error.
This function should be used by private functions in the library.
Provided Methods§
Sourcefn parse(input: &mut Parser<'source>) -> ParseResult<Self>
fn parse(input: &mut Parser<'source>) -> ParseResult<Self>
Parses a value from the given stream of tokens, advancing the stream past the consumed tokens if parsing is successful.
This function should be used by users of this parser.
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.