pub trait Handler: Send + Sync {
// Required method
fn handle(&self, req: &Request) -> Response;
}Expand description
Turns a Request into a Response.
The trait is deliberately synchronous: the engine is sans-I/O and every
runtime (thread pool, tokio, mio) calls the handler the same way, so a
single handler implementation works everywhere. Handlers must be Send + Sync because they are shared across worker threads / tasks.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".