pub trait Parse: Sized {
// Required method
fn parse(
&self,
input: &mut Context<impl Stream>,
) -> Result<Box<dyn Tree>, String>;
// Provided method
fn parse_stream<I: Stream>(self, input: I) -> ParseStream<Self, I> { ... }
}Expand description
Parse a Stream.
Required Methods§
Sourcefn parse(
&self,
input: &mut Context<impl Stream>,
) -> Result<Box<dyn Tree>, String>
fn parse( &self, input: &mut Context<impl Stream>, ) -> Result<Box<dyn Tree>, String>
Read input Trees from input and try to make a single output tree.
Special cases:
- An unrecognised input tree should be passed on unchanged.
- In particular,
EndOfFileshould be passed on unchanged. It must never be incorporated into a larger parse tree.
- In particular,
- If this parser finds a parse error, abandon the current parse tree
and return
Err(message). - If
inputreports a parse error, abandon the current parse tree and pass on the error unchanged.- In particular, if
inputreports an incomplete file, pass it on.
- In particular, if
Provided Methods§
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.