pub trait ServeHttp {
// Required method
fn response<'life0, 'life1, 'async_trait>(
&'life0 self,
http_session: &'life1 mut ServerSession,
) -> Pin<Box<dyn Future<Output = Response<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
This trait defines how to map a request to a response
Required Methods§
Sourcefn response<'life0, 'life1, 'async_trait>(
&'life0 self,
http_session: &'life1 mut ServerSession,
) -> Pin<Box<dyn Future<Output = Response<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn response<'life0, 'life1, 'async_trait>(
&'life0 self,
http_session: &'life1 mut ServerSession,
) -> Pin<Box<dyn Future<Output = Response<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Define the mapping from a request to a response. Note that the request header is already read, but the implementation needs to read the request body if any.
§Limitation
In this API, the entire response has to be generated before the end of this call.
So it is not suitable for streaming response or interactive communications.
Users need to implement their own super::HttpServerApp
for those use cases.