pub trait RequestHandler: Send + Sync + 'static {
    // Required method
    fn handle_request<'life0, 'async_trait>(
        &'life0 self,
        request: Box<CoapRequest<SocketAddr>>
    ) -> Pin<Box<dyn Future<Output = Box<CoapRequest<SocketAddr>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A trait for handling incoming requests. Use this instead of a closure if you want to modify some external state

Required Methods§

source

fn handle_request<'life0, 'async_trait>( &'life0 self, request: Box<CoapRequest<SocketAddr>> ) -> Pin<Box<dyn Future<Output = Box<CoapRequest<SocketAddr>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§

source§

impl<F, HandlerRet> RequestHandler for F
where F: Fn(Box<CoapRequest<SocketAddr>>) -> HandlerRet + Send + Sync + 'static, HandlerRet: Future<Output = Box<CoapRequest<SocketAddr>>> + Send,