Trait Responder

Source
pub trait Responder: Send {
    // Required method
    fn respond<'a>(
        &mut self,
        req: &'a Request<Bytes>,
    ) -> Pin<Box<dyn Future<Output = Response<Bytes>> + Send + 'a>>;
}
Expand description

Respond with an HTTP response.

Required Methods§

Source

fn respond<'a>( &mut self, req: &'a Request<Bytes>, ) -> Pin<Box<dyn Future<Output = Response<Bytes>> + Send + 'a>>

Return a future that outputs an HTTP response.

Implementations on Foreign Types§

Source§

impl<B> Responder for Response<B>
where B: Clone + Into<Bytes> + Send + Debug,

Source§

fn respond<'a>( &mut self, _req: &'a Request<Bytes>, ) -> Pin<Box<dyn Future<Output = Response<Bytes>> + Send + 'a>>

Implementors§

Source§

impl Responder for Cycle

Source§

impl<B> Responder for ResponseBuilder<B>
where B: Clone + Into<Bytes> + Send + Debug,

Source§

impl<F, B> Responder for F
where F: FnMut() -> B + Clone + Send + 'static, B: Responder,

Respond with the response returned from the provided function.

Source§

impl<R: Responder> Responder for Delay<R>