pub trait LexerError<P>: Sized + Error {
// Required method
fn failed_to_parse(state: P, ch: char) -> Self;
}
Expand description
A trait required of an error within a Lexer - a char that does not match any token parser rust return an error, and this trait requires that such an error be provided
It might be nice to have this take the Lexer too, but then there is a cycle in that Lexer::Error will in general depend on Lexer which depends on Lexer::Error… This breaks code (and the compiler tends to hang forever)
Required Methods§
Sourcefn failed_to_parse(state: P, ch: char) -> Self
fn failed_to_parse(state: P, ch: char) -> Self
Return an error indicating that a bad character (could not be matched for a token) has occurred at the position indicated by the state
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.