Expand description
This module provides traits and structs that relate to the handler functions that we can pass to API routes.
Re-exports§
pub use body::HandlerBody;pub use response::HandlerResponse;
Modules§
- body
- This contains the
HandlerBodytrait, which you can implement on a type in order to allow it to be used at a parameter in a handler function which can extract data from the request body. A couple of convenience types (body::FromJsonandbody::FromBinary) are exposed which implement this trait. - request
- This contains helpers around the body that you’ll need to provide as part
of an
http::Request, mainly geared around allowing requests to be streamed in if desired. This module provides some functionality for creating a valid request body to send to Seamless as part of anhttp::Request. Essentially, anything implementingAsyncRead + Send + Unpincan be provided as a request body, but this module provides aBytesstruct which can easily convert aVec<u8>orfutures::Streaminto such a body. - response
- This contains the
HandlerResponsetrait, which determines how to form an HTTP response given some type. Implement this for types that you wish to be able to return from handler functions.
Traits§
- Handler
Param - Implement this for anything that you want to be able to pass into a request handler that doesn’t want to consume the body of the request. This is useful for implementing request guards which prevent the handler from being called unless specific conditions are met (for instance a user is logged in).