pub trait ParserError {
// Required methods
fn from_parser_error<T: ?Sized + Sequence>(
input: *const T,
parser_type: ParserType,
) -> Self;
fn from_external_error<T: ?Sized + Sequence, E: Error + Send + Sync + 'static>(
input: *const T,
parser_type: ParserType,
cause: E,
) -> Self;
// Provided methods
fn add_context<T: ?Sized + Sequence>(
&mut self,
_input: *const T,
_parser_type: ParserType,
) { ... }
fn get_loc(&self) -> Option<usize> { ... }
}
Expand description
Trait for a parser error. This can store information about the type of parser
that generated the error and its location. This is implemented by FabError
and
NoContextFabError
.
In order to simplify lifetimes used by the error, the parser error stores a pointer to the location the error occured rather than a reference. This doesn’t require unsafe to use properly.
Required Methods§
fn from_parser_error<T: ?Sized + Sequence>( input: *const T, parser_type: ParserType, ) -> Self
fn from_external_error<T: ?Sized + Sequence, E: Error + Send + Sync + 'static>( input: *const T, parser_type: ParserType, cause: E, ) -> Self
Provided Methods§
fn add_context<T: ?Sized + Sequence>( &mut self, _input: *const T, _parser_type: ParserType, )
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.
Implementors§
impl ParserError for FabError
impl ParserError for NoContextFabError
If you don’t care about the errors, and want speed, this type implements ParserError. It contains no information.