cgp_error

Trait CanRaiseError

Source
pub trait CanRaiseError<E>: HasErrorType {
    // Required method
    fn raise_error(e: E) -> Self::Error;
}
Expand description

Used for injecting external error types into Self::Error.

As an example, if Context: CanRaiseError<ParseIntError>, then we would be able to call Context::raise_error(err) for an error value err: ParseIntError and get back a Context::Error value.

Required Methods§

Source

fn raise_error(e: E) -> Self::Error

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§

Source§

impl<Context, E> CanRaiseError<E> for Context
where Context: HasErrorType + HasComponents, Context::Components: ErrorRaiser<Context, E>,

Used for injecting external error types into Self::Error.

As an example, if Context: CanRaiseError<ParseIntError>, then we would be able to call Context::raise_error(err) for an error value err: ParseIntError and get back a Context::Error value.