Trait ErrorResponse

Source
pub trait ErrorResponse:
    StdError
    + IntoResponse
    + 'static {
    // Provided method
    fn into_error_result(self) -> Result<Response, BoxedErrorResponse>
       where Self: Sized + Send + Sync { ... }
}
Expand description

Blanketly implemented by error types that can be converted into the Response type.

Provided Methods§

Source

fn into_error_result(self) -> Result<Response, BoxedErrorResponse>
where Self: Sized + Send + Sync,

Converts the ErrorResponse into ResponseResult::Err(BoxedErrorResponse).

Implementations§

Source§

impl dyn ErrorResponse + Send + Sync

Source

pub fn implementor_type_id(&self) -> TypeId

Returns the TypeId of the implementor.

Source

pub fn is<E: Any + 'static>(&self) -> bool

Checks whether the implementor of the trait is the given type E.

Source

pub fn downcast_to<E: Any + 'static>( self: Box<Self>, ) -> Result<Box<E>, Box<Self>>

Casts the trait object into type E if it’s an underlying concrete type.

Source

pub fn downcast_to_ref<E: Any + 'static>(&self) -> Option<&E>

Returns a reference to an underlying concrete type if it’s a type E.

Source

pub fn downcast_to_mut<E: Any + 'static>(&mut self) -> Option<&mut E>

Returns a mutable reference to an underlying concrete type if it’s a type E.

Source

pub fn into_response(self: Box<Self>) -> Response

Converts the error into Response.

Implementors§

Source§

impl<E> ErrorResponse for E
where E: StdError + IntoResponse + Send + Sync + 'static,