Trait fibers_http_server::HandleRequest [] [src]

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;

    fn handle_request(&self, req: Req<Self::ReqBody>) -> Self::Reply;

    fn handle_request_head(&self, req: &Req<()>) -> Option<Res<Self::ResBody>> { ... }
fn handle_decoding_error(
        &self,
        req: Req<()>,
        error: &Error
    ) -> Option<Res<Self::ResBody>> { ... } }

HandleRequest allows for handling HTTP requests.

Associated Types

The type of the request bodies.

The type of the response bodies.

Request body decoder.

Response body encoder.

Future that represents reply to a request.

Associated Constants

The method that the handler can handle.

The request path that the handler can handle.

* and ** in the path have the special meanings as follows:

  • * matches any path segment (i.e., regarded as a wildcard)
  • ** matches all remaining parts of a path

Required Methods

Handles a request.

Provided Methods

Handles the head part of a request.

If a Some(..) value is returned, the invocation of handle_request method will be skipped.

The default implementation always returns None.

Handles an error occurred while decoding the body of a request.

The default implementation always returns None (i.e., the default error response will be returned to the HTTP client).

Implementors