pub trait Parse<'a, Octs: ?Sized>: Sized {
// Required method
fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>;
}
Expand description
An extension trait to add parsing to foreign types.
This trait can be used to add the parse
method to a foreign type. For
local types, the method should be added directly to the type instead.
Required Methods§
sourcefn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>
fn parse(parser: &mut Parser<'a, Octs>) -> Result<Self, ParseError>
Extracts a value from the beginning of parser
.
If parsing fails and an error is returned, the parser’s position should be considered to be undefined. If it is supposed to be reused in this case, you should store the position before attempting to parse and seek to that position again before continuing.
Object Safety§
This trait is not object safe.