pub trait GenericError: Sized {
type Inner;
// Required method
fn to_errors(self) -> Result<Self::Inner, Errors>;
}Expand description
A trait to convert a specific result type into a generic one.
This lets you convert Result<T, E> or Result<T, Vec<E>> into
Result<T, Errors> for any error type E defined in this library.
In this way you can ignore the specific type of error when you don’t
need to handle them explicitly (which is most of the time).
Example Usage:
ⓘ
fn test() -> Result<(), Errors> {
...
let program = parser.done().to_errors()?;
program.type_check().to_errors()?;
}Required Associated Types§
Required 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.