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§
Required Methods§
Sourcefn from_error(error: Self::Error) -> Self
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".