Skip to main content

Fallible

Trait Fallible 

Source
pub trait Fallible {
    type Error: 'static;

    // Required method
    fn from_error(error: Self::Error) -> Self;
}
Expand description

A handler Output that can represent a failure.

The fallible handlers (try_filter, try_map, try_filter_map) take a function that returns Result. On Ok, execution continues as usual; on Err(e), the chain short-circuits and ends the dispatch with the error as the output; the same way endpoint ends it with a value.

Result implements this out of the box. Implement it yourself if your Output is another type that can still represent an error (e.g. an HTTP response that encodes it in the status code).

Required Associated Types§

Source

type Error: 'static

The error type carried by this output.

Required Methods§

Source

fn from_error(error: Self::Error) -> Self

Constructs an output value representing the given error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T, E: 'static> Fallible for Result<T, E>

Source§

type Error = E

Source§

fn from_error(error: E) -> Self

Implementors§