pub trait HandleRequest:
Sized
+ Send
+ Sync
+ 'static {
type ReqBody: Send + 'static;
type ResBody: Send + 'static;
type Decoder: BodyDecode<Item = Self::ReqBody> + Send + 'static;
type Encoder: BodyEncode<Item = Self::ResBody> + Send + 'static;
type Reply: Future<Item = Res<Self::ResBody>, Error = Never> + Send + 'static;
const METHOD: &'static str;
const PATH: &'static str;
// Required method
fn handle_request(&self, req: Req<Self::ReqBody>) -> Self::Reply;
// Provided methods
fn handle_request_head(&self, req: &Req<()>) -> Option<Res<Self::ResBody>> { ... }
fn handle_decoding_error(
&self,
req: Req<()>,
error: &Error,
) -> Option<Res<Self::ResBody>> { ... }
}
Expand description
HandleRequest
allows for handling HTTP requests.
Required Associated Constants§
Required Associated Types§
Sourcetype Decoder: BodyDecode<Item = Self::ReqBody> + Send + 'static
type Decoder: BodyDecode<Item = Self::ReqBody> + Send + 'static
Request body decoder.
Sourcetype Encoder: BodyEncode<Item = Self::ResBody> + Send + 'static
type Encoder: BodyEncode<Item = Self::ResBody> + Send + 'static
Response body encoder.
Required Methods§
Sourcefn handle_request(&self, req: Req<Self::ReqBody>) -> Self::Reply
fn handle_request(&self, req: Req<Self::ReqBody>) -> Self::Reply
Handles a request.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.