Skip to main content

Handler

Trait Handler 

Source
pub trait Handler:
    Send
    + Sync
    + 'static {
    // Required method
    fn handle(&self, request: Request) -> Response;
}
Expand description

Trait implemented by application handlers.

Required Methods§

Source

fn handle(&self, request: Request) -> Response

Handle a request and produce a response. Async support will be added later using Tokio primitives.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Handler for DefaultRouter

Source§

impl Handler for Router

Source§

impl<F> Handler for F
where F: Fn(Request) -> Response + Send + Sync + 'static,