pub trait Handler:
Send
+ Sync
+ 'static {
// Required method
fn dispatch<'life0, 'async_trait>(
&'life0 self,
req: Request,
) -> Pin<Box<dyn Future<Output = DispatchOutcome> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Server-side dispatcher. Callers implement this against their own
application state and pass an Arc<H> to spawn_unix_server or
crate::spawn_http_server.
Required Methods§
Sourcefn dispatch<'life0, 'async_trait>(
&'life0 self,
req: Request,
) -> Pin<Box<dyn Future<Output = DispatchOutcome> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn dispatch<'life0, 'async_trait>(
&'life0 self,
req: Request,
) -> Pin<Box<dyn Future<Output = DispatchOutcome> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dispatch a parsed request to either a one-shot result or a streaming event source. The server frames whichever outcome the handler returns.