rocket_community/response/mod.rs
1//! Types and traits to build and send responses.
2//!
3//! The return type of a Rocket handler can be any type that implements the
4//! [`Responder`] trait, which means that the type knows how to generate a
5//! [`Response`]. Among other things, this module contains several such types.
6//!
7//! # Composing
8//!
9//! Many of the built-in `Responder` types _chain_ responses: they take in
10//! another `Responder` and add, remove, or change information in the response.
11//! In other words, many `Responder` types are built to compose well. As a
12//! result, you'll often have types of the form `A<B<C>>` consisting of three
13//! `Responder`s `A`, `B`, and `C`. This is normal and encouraged as the type
14//! names typically illustrate the intended response.
15
16mod body;
17mod debug;
18mod redirect;
19mod responder;
20mod response;
21
22pub(crate) mod flash;
23
24pub mod content;
25pub mod status;
26pub mod stream;
27
28#[doc(hidden)]
29pub use rocket_codegen::Responder;
30
31pub use self::body::Body;
32pub use self::debug::Debug;
33pub use self::flash::Flash;
34pub use self::redirect::Redirect;
35pub use self::responder::Responder;
36pub use self::response::{Builder, Response};
37
38/// Type alias for the `Result` of a [`Responder::respond_to()`] call.
39pub type Result<'r> = std::result::Result<Response<'r>, crate::http::Status>;