Skip to main content

HandlerResult

Trait HandlerResult 

Source
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:

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§

Source

type Error

The error type generated by the handler.

Required Methods§

Source

fn send(self) -> Result<(), Self::Error>

Perform any remaining work to send this response downstream.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl HandlerResult for ()

Source§

type Error = !

Source§

fn send(self) -> Result<(), Self::Error>

Source§

impl<E> HandlerResult for Result<(), E>
where E: Display,

Source§

type Error = E

Source§

fn send(self) -> Result<(), Self::Error>

Source§

impl<E> HandlerResult for Result<PendingRequest, E>
where E: Display,

Source§

type Error = E

Source§

fn send(self) -> Result<(), Self::Error>

Source§

impl<E> HandlerResult for Result<Response, E>
where E: Display,

Source§

type Error = E

Source§

fn send(self) -> Result<(), Self::Error>

Implementors§