Skip to main content

Handler

Trait Handler 

Source
pub trait Handler:
    Send
    + Sync
    + 'static {
    // Required method
    fn handle(&self, request: Request) -> impl Future<Output = Vec<u8>> + Send;
}
Expand description

The application seam: turn a Request into response bytes. Nex has no status codes, so “not found” is whatever text the handler chooses.

Required Methods§

Source

fn handle(&self, request: Request) -> impl Future<Output = Vec<u8>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl Handler for FileHandler

Source§

impl<F, Fut> Handler for F
where F: Fn(Request) -> Fut + Send + Sync + 'static, Fut: Future<Output = Vec<u8>> + Send,