pub trait RefineErr {
// Required method
fn refine_err<T>(self) -> Self
where Self: Sized;
}Expand description
Helper Trait for refining error type names. Every parser type in unsynn eventually tries to parse one of the fundamental types. When parsing fails then that fundamental type name is recorded as expected type name of the error. Often this is not desired, a user wants to know the type of parser that actually failed. Since we don’t want to keep a stack/vec of errors for simplicity and performance reasons we provide a way to register refined type names in errors. Note that this refinement should only be applied to leaves in the AST. Refining errors on composed types will lead to unexpected results.
Required Methods§
Sourcefn refine_err<T>(self) -> Selfwhere
Self: Sized,
fn refine_err<T>(self) -> Selfwhere
Self: Sized,
Refines a errors type name to the type name of T.