Expand description
Types and traits to build and send responses.
The return type of a Rocket handler can be any type that implements the
Responder
trait, which means that the type knows how to generate a
Response
. Among other things, this module contains several such types.
§Composing
Many of the built-in Responder
types chain responses: they take in
another Responder
and add, remove, or change information in the response.
In other words, many Responder
types are built to compose well. As a
result, you’ll often have types of the form A<B<C>>
consisting of three
Responder
s A
, B
, and C
. This is normal and encouraged as the type
names typically illustrate the intended response.
Modules§
- content
- Contains types that set the Content-Type of a response.
- status
- Contains types that set the status code and corresponding headers of a response.
- stream
- Potentially infinite async
Stream
response types.
Structs§
- Body
- The body of a
Response
. - Builder
- Builder for the
Response
type. - Debug
- Debug prints the internal value before forwarding to the 500 error catcher.
- Flash
- Sets a “flash” cookie that will be removed when it is accessed. The
analogous request type is
FlashMessage
. - Redirect
- An empty redirect response to a given URL.
- Response
- A response, as returned by types implementing
Responder
.
Traits§
- Responder
- Trait implemented by types that generate responses for clients.
Type Aliases§
- Result
- Type alias for the
Result
of aResponder::respond_to()
call.