Skip to main content

Handler

Trait Handler 

Source
pub trait Handler:
    Send
    + Sync
    + 'static {
    // Required method
    fn call(
        &self,
        data: &[u8],
        ctx: RequestContext,
    ) -> BoxFuture<'static, HandlerResult>;
}
Expand description

Trait for handler functions.

Required Methods§

Source

fn call( &self, data: &[u8], ctx: RequestContext, ) -> BoxFuture<'static, HandlerResult>

Handle a request with raw payload bytes.

Implementors§

Source§

impl<F, T, Fut> Handler for TypedHandler<F, T, Fut>
where F: Fn(T, RequestContext) -> Fut + Send + Sync + 'static, T: DeserializeOwned + Send + 'static, Fut: Future<Output = HandlerResult> + Send + 'static,