pub trait Parser<T = SourceFile> {
type Error: Error;
// Required method
fn parse_stream(&mut self, tokens: TokenStream) -> Result<T, Self::Error>;
}Expand description
A parser backend that produces one typed syntax target.
Backends may construct T directly or adapt their concrete syntax tree
through ExternalCstNode and reconstruct.
Required Associated Types§
Required Methods§
Sourcefn parse_stream(&mut self, tokens: TokenStream) -> Result<T, Self::Error>
fn parse_stream(&mut self, tokens: TokenStream) -> Result<T, Self::Error>
Parses tokens into one typed syntax target.
§Errors
Returns the backend’s Self::Error when it cannot produce T.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".