pub trait HandlerResult {
type Error;
// Required method
fn send(self) -> Result<(), Self::Error>;
}Expand description
Trait for supporting more flexible return types for the handler passed to Serve::run.
The types that this is implemented for by default are:
Response, for a handler that always generates a response.(), for a handler that has already called either Response::send_to_client or Response::stream_to_client.Result<(), E>, for a handler that has already called either Response::send_to_client or Response::stream_to_client, but might fail with an error of typeEalong the way.Result<Response, E>, for a handle the might generate a response to send or an error.
For the Result implementations, a return value containing an error will attempt to send
a 500 response status with a body containing the ToString::to_string representation of the
error, in the same way that fastly::main does.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".