Module rocket::response [−][src]
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.
Contrib
The contrib
crate contains several useful Responder
s including
Template
and Json
.
Modules
Contains types that set the Content-Type of a response.
Contains types that set the status code and corresponding headers of a response.
Structs
Sets the Content-Type of a Responder
to a chosen value.
Debug prints the internal value before responding with a 500 error.
Sets a “flash” cookie that will be removed when it is accessed. The
analogous request type is FlashMessage
.
A file with an associated name; responds with the Content-Type based on the file extension.
An empty redirect response to a given URL.
A response, as returned by types implementing Responder
.
Type for easily building Response
s.
Streams a response to a client from an arbitrary Read
er type.
Enums
The body of a response: can be sized or streamed/chunked.
Constants
The default size, in bytes, of a chunk for streamed responses.
Traits
Trait implemented by types that generate responses for clients.
Type Definitions
Type alias for the Result
of a Responder::respond
call.