Skip to main content

Handler

Trait Handler 

Source
pub trait Handler<S>:
    RouteSpec
    + Send
    + Sync
    + 'static {
    // Required method
    fn handle(
        &self,
        request: &Request,
        params: &PathParams,
        connection: &ConnectionInfo,
        state: &Arc<S>,
    ) -> Response;
}
Expand description

A typed handler for apps with state S, made by the route macros from a function whose arguments are extractors. Register it with .route(h).

Required Methods§

Source

fn handle( &self, request: &Request, params: &PathParams, connection: &ConnectionInfo, state: &Arc<S>, ) -> Response

Extract the arguments, call the function and turn its value into a Response (or answer with the first argument’s rejection).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§