Update many doc tests in 'core' for async.

This commit is contained in:
Jeb Rosen 2019-08-06 17:08:00 -07:00
parent 4354ebc6ab
commit 0fb3b8f584
49 changed files with 162 additions and 136 deletions

View File

@ -50,7 +50,7 @@
//! In your application's source code, one-time: //! In your application's source code, one-time:
//! //!
//! ```rust //! ```rust
//! #![feature(proc_macro_hygiene)] //! #![feature(proc_macro_hygiene, async_await)]
//! //!
//! #[macro_use] extern crate rocket; //! #[macro_use] extern crate rocket;
//! #[macro_use] extern crate rocket_contrib; //! #[macro_use] extern crate rocket_contrib;

View File

@ -42,7 +42,7 @@ pub use self::uuid_crate::parser::ParseError;
/// You can use the `Uuid` type directly as a target of a dynamic parameter: /// You can use the `Uuid` type directly as a target of a dynamic parameter:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # #[macro_use] extern crate rocket_contrib; /// # #[macro_use] extern crate rocket_contrib;
/// use rocket_contrib::uuid::Uuid; /// use rocket_contrib::uuid::Uuid;
@ -56,7 +56,7 @@ pub use self::uuid_crate::parser::ParseError;
/// You can also use the `Uuid` as a form value, including in query strings: /// You can also use the `Uuid` as a form value, including in query strings:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # #[macro_use] extern crate rocket_contrib; /// # #[macro_use] extern crate rocket_contrib;
/// use rocket_contrib::uuid::Uuid; /// use rocket_contrib::uuid::Uuid;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] #[macro_use]
#[cfg(all(feature = "brotli_compression", feature = "gzip_compression"))] #[cfg(all(feature = "brotli_compression", feature = "gzip_compression"))]

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] #[macro_use]
#[cfg(all(feature = "brotli_compression", feature = "gzip_compression"))] #[cfg(all(feature = "brotli_compression", feature = "gzip_compression"))]

View File

@ -30,7 +30,7 @@
//! crate root: //! crate root:
//! //!
//! ```rust //! ```rust
//! #![feature(proc_macro_hygiene)] //! #![feature(proc_macro_hygiene, async_await)]
//! //!
//! #[macro_use] extern crate rocket; //! #[macro_use] extern crate rocket;
//! # #[get("/")] fn hello() { } //! # #[get("/")] fn hello() { }
@ -40,7 +40,7 @@
//! Or, alternatively, selectively import from the top-level scope: //! Or, alternatively, selectively import from the top-level scope:
//! //!
//! ```rust //! ```rust
//! #![feature(proc_macro_hygiene)] //! #![feature(proc_macro_hygiene, async_await)]
//! # extern crate rocket; //! # extern crate rocket;
//! //!
//! use rocket::{get, routes}; //! use rocket::{get, routes};
@ -147,7 +147,7 @@ macro_rules! route_attribute {
/// functions: /// functions:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// #[get("/")] /// #[get("/")]
@ -170,7 +170,7 @@ macro_rules! route_attribute {
/// explicitly specified: /// explicitly specified:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// #[route(GET, path = "/")] /// #[route(GET, path = "/")]
@ -231,7 +231,7 @@ macro_rules! route_attribute {
/// the arguments `foo`, `baz`, `msg`, `rest`, and `form`: /// the arguments `foo`, `baz`, `msg`, `rest`, and `form`:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # use rocket::request::Form; /// # use rocket::request::Form;
/// # use std::path::PathBuf; /// # use std::path::PathBuf;
@ -343,7 +343,7 @@ route_attribute!(options => Method::Options);
/// This attribute can only be applied to free functions: /// This attribute can only be applied to free functions:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// use rocket::Request; /// use rocket::Request;
@ -755,7 +755,7 @@ pub fn derive_uri_display_path(input: TokenStream) -> TokenStream {
/// corresponding [`Route`] structures. For example, given the following routes: /// corresponding [`Route`] structures. For example, given the following routes:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// #[get("/")] /// #[get("/")]
@ -770,7 +770,7 @@ pub fn derive_uri_display_path(input: TokenStream) -> TokenStream {
/// The `routes!` macro can be used as: /// The `routes!` macro can be used as:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// # use rocket::http::Method; /// # use rocket::http::Method;
@ -814,7 +814,7 @@ pub fn routes(input: TokenStream) -> TokenStream {
/// catchers: /// catchers:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// #[catch(404)] /// #[catch(404)]
@ -829,7 +829,7 @@ pub fn routes(input: TokenStream) -> TokenStream {
/// The `catchers!` macro can be used as: /// The `catchers!` macro can be used as:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// # #[catch(404)] fn not_found() { /* .. */ } /// # #[catch(404)] fn not_found() { /* .. */ }
@ -871,7 +871,7 @@ pub fn catchers(input: TokenStream) -> TokenStream {
/// For example, for the following route: /// For example, for the following route:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// #[get("/person/<name>?<age>")] /// #[get("/person/<name>?<age>")]
@ -885,7 +885,7 @@ pub fn catchers(input: TokenStream) -> TokenStream {
/// A URI can be created as follows: /// A URI can be created as follows:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// # #[get("/person/<name>?<age>")] /// # #[get("/person/<name>?<age>")]

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
use rocket::local::Client; use rocket::local::Client;
use rocket::response::Responder; use rocket::response::Responder;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#![allow(dead_code, unused_variables)] #![allow(dead_code, unused_variables)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,6 +1,6 @@
// must-compile-successfully // must-compile-successfully
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,7 +1,7 @@
// normalize-stderr-test: "<(.*) as (.*)>" -> "$1 as $$TRAIT" // normalize-stderr-test: "<(.*) as (.*)>" -> "$1 as $$TRAIT"
// normalize-stderr-test: "and \d+ others" -> "and $$N others" // normalize-stderr-test: "and \d+ others" -> "and $$N others"
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -53,7 +53,7 @@ mod key {
/// a handler to retrieve the value of a "message" cookie. /// a handler to retrieve the value of a "message" cookie.
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::http::Cookies; /// use rocket::http::Cookies;
/// ///
@ -73,7 +73,7 @@ mod key {
/// [private cookie]: Cookies::add_private() /// [private cookie]: Cookies::add_private()
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// use rocket::http::Status; /// use rocket::http::Status;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#![recursion_limit="512"] #![recursion_limit="512"]
#![warn(rust_2018_idioms)] #![warn(rust_2018_idioms)]

View File

@ -155,7 +155,7 @@ use crate::uri::{self, UriPart, UriDisplay};
/// With these implementations, the following typechecks: /// With these implementations, the following typechecks:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # use std::fmt; /// # use std::fmt;
/// use rocket::http::RawStr; /// use rocket::http::RawStr;

View File

@ -61,7 +61,7 @@ use crate::uri::{Uri, UriPart, Path, Query, Formatter};
/// the following route: /// the following route:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// #[get("/item/<id>?<track>")] /// #[get("/item/<id>?<track>")]
/// fn get_item(id: i32, track: Option<String>) { /* .. */ } /// fn get_item(id: i32, track: Option<String>) { /* .. */ }
@ -70,7 +70,7 @@ use crate::uri::{Uri, UriPart, Path, Query, Formatter};
/// A URI for this route can be generated as follows: /// A URI for this route can be generated as follows:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # type T = (); /// # type T = ();
/// # #[get("/item/<id>?<track>")] /// # #[get("/item/<id>?<track>")]
@ -234,7 +234,7 @@ use crate::uri::{Uri, UriPart, Path, Query, Formatter};
/// `UriDisplay` implementation is required. /// `UriDisplay` implementation is required.
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::http::RawStr; /// use rocket::http::RawStr;
/// use rocket::request::FromParam; /// use rocket::request::FromParam;
@ -432,7 +432,7 @@ impl<T: UriDisplay<Query>, E> UriDisplay<Query> for Result<T, E> {
/// trait for the corresponding `UriPart`. /// trait for the corresponding `UriPart`.
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// #[get("/item/<id>?<track>")] /// #[get("/item/<id>?<track>")]
/// fn get_item(id: i32, track: Option<u8>) { /* .. */ } /// fn get_item(id: i32, track: Option<u8>) { /* .. */ }

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;

View File

@ -1,4 +1,4 @@
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene, async_await)]
// #![feature(alloc_system)] // #![feature(alloc_system)]
// extern crate alloc_system; // extern crate alloc_system;

View File

@ -36,7 +36,7 @@ use yansi::Color::*;
/// declared using the `catch` decorator, as follows: /// declared using the `catch` decorator, as follows:
/// ///
/// ```rust /// ```rust
/// #![feature(proc_macro_hygiene)] /// #![feature(proc_macro_hygiene, async_await)]
/// ///
/// #[macro_use] extern crate rocket; /// #[macro_use] extern crate rocket;
/// ///
@ -78,16 +78,17 @@ impl Catcher {
/// ```rust /// ```rust
/// # #![allow(unused_variables)] /// # #![allow(unused_variables)]
/// use rocket::{Catcher, Request}; /// use rocket::{Catcher, Request};
/// use rocket::handler::ErrorHandlerFuture;
/// use rocket::response::{Result, Responder}; /// use rocket::response::{Result, Responder};
/// use rocket::response::status::Custom; /// use rocket::response::status::Custom;
/// use rocket::http::Status; /// use rocket::http::Status;
/// ///
/// fn handle_404<'r>(req: &'r Request) -> Result<'r> { /// fn handle_404<'r>(req: &'r Request) -> ErrorHandlerFuture<'r> {
/// let res = Custom(Status::NotFound, format!("404: {}", req.uri())); /// let res = Custom(Status::NotFound, format!("404: {}", req.uri()));
/// res.respond_to(req) /// res.respond_to(req)
/// } /// }
/// ///
/// fn handle_500<'r>(req: &'r Request) -> Result<'r> { /// fn handle_500<'r>(req: &'r Request) -> ErrorHandlerFuture<'r> {
/// "Whoops, we messed up!".respond_to(req) /// "Whoops, we messed up!".respond_to(req)
/// } /// }
/// ///

View File

@ -23,7 +23,7 @@ const PEEK_BYTES: usize = 512;
/// specifying the `data = "<var>"` route parameter as follows: /// specifying the `data = "<var>"` route parameter as follows:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # type DataGuard = rocket::data::Data; /// # type DataGuard = rocket::data::Data;
/// #[post("/submit", data = "<var>")] /// #[post("/submit", data = "<var>")]

View File

@ -117,12 +117,15 @@ impl AdHoc {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # #![feature(async_await)]
/// use rocket::fairing::AdHoc; /// use rocket::fairing::AdHoc;
/// ///
/// // The no-op response fairing. /// // The no-op response fairing.
/// let fairing = AdHoc::on_response("Dummy", |req, resp| { /// let fairing = AdHoc::on_response("Dummy", |req, resp| {
/// // do something with the request and pending response... /// Box::pin(async move {
/// # let (_, _) = (req, resp); /// // do something with the request and pending response...
/// # let (_, _) = (req, resp);
/// })
/// }); /// });
/// ``` /// ```
pub fn on_response<F>(name: &'static str, f: F) -> AdHoc pub fn on_response<F>(name: &'static str, f: F) -> AdHoc

View File

@ -20,9 +20,10 @@
//! write: //! write:
//! //!
//! ```rust //! ```rust
//! # #![feature(async_await)]
//! # use rocket::fairing::AdHoc; //! # use rocket::fairing::AdHoc;
//! # let req_fairing = AdHoc::on_request("Request", |_, _| ()); //! # let req_fairing = AdHoc::on_request("Request", |_, _| ());
//! # let res_fairing = AdHoc::on_response("Response", |_, _| ()); //! # let res_fairing = AdHoc::on_response("Response", |_, _| Box::pin(async move {}));
//! let rocket = rocket::ignite() //! let rocket = rocket::ignite()
//! .attach(req_fairing) //! .attach(req_fairing)
//! .attach(res_fairing); //! .attach(res_fairing);
@ -206,7 +207,10 @@ pub use self::info_kind::{Info, Kind};
/// path. /// path.
/// ///
/// ```rust /// ```rust
/// # #![feature(async_await)]
/// use std::future::Future;
/// use std::io::Cursor; /// use std::io::Cursor;
/// use std::pin::Pin;
/// use std::sync::atomic::{AtomicUsize, Ordering}; /// use std::sync::atomic::{AtomicUsize, Ordering};
/// ///
/// use rocket::{Request, Data, Response}; /// use rocket::{Request, Data, Response};
@ -235,21 +239,23 @@ pub use self::info_kind::{Info, Kind};
/// } /// }
/// } /// }
/// ///
/// fn on_response(&self, request: &Request, response: &mut Response) { /// fn on_response<'a, 'r>(&'a self, request: &'a Request<'r>, response: &'a mut Response<'r>) -> Pin<Box<dyn Future<Output=()> + Send + 'a>> {
/// // Don't change a successful user's response, ever. /// Box::pin(async move {
/// if response.status() != Status::NotFound { /// // Don't change a successful user's response, ever.
/// return /// if response.status() != Status::NotFound {
/// } /// return
/// }
/// ///
/// if request.method() == Method::Get && request.uri().path() == "/counts" { /// if request.method() == Method::Get && request.uri().path() == "/counts" {
/// let get_count = self.get.load(Ordering::Relaxed); /// let get_count = self.get.load(Ordering::Relaxed);
/// let post_count = self.post.load(Ordering::Relaxed); /// let post_count = self.post.load(Ordering::Relaxed);
/// ///
/// let body = format!("Get: {}\nPost: {}", get_count, post_count); /// let body = format!("Get: {}\nPost: {}", get_count, post_count);
/// response.set_status(Status::Ok); /// response.set_status(Status::Ok);
/// response.set_header(ContentType::Plain); /// response.set_header(ContentType::Plain);
/// response.set_sized_body(Cursor::new(body)); /// response.set_sized_body(Cursor::new(body));
/// } /// }
/// })
/// } /// }
/// } /// }
/// ``` /// ```
@ -265,6 +271,9 @@ pub use self::info_kind::{Info, Kind};
/// request guard. /// request guard.
/// ///
/// ```rust /// ```rust
/// # #![feature(async_await)]
/// # use std::future::Future;
/// # use std::pin::Pin;
/// # use std::time::{Duration, SystemTime}; /// # use std::time::{Duration, SystemTime};
/// # use rocket::Outcome; /// # use rocket::Outcome;
/// # use rocket::{Request, Data, Response}; /// # use rocket::{Request, Data, Response};
@ -297,12 +306,14 @@ pub use self::info_kind::{Info, Kind};
/// ///
/// /// Adds a header to the response indicating how long the server took to /// /// Adds a header to the response indicating how long the server took to
/// /// process the request. /// /// process the request.
/// fn on_response(&self, request: &Request, response: &mut Response) { /// fn on_response<'a, 'r>(&'a self, request: &'a Request<'r>, response: &'a mut Response<'r>) -> Pin<Box<dyn Future<Output=()> + Send + 'a>> {
/// let start_time = request.local_cache(|| TimerStart(None)); /// Box::pin(async move {
/// if let Some(Ok(duration)) = start_time.0.map(|st| st.elapsed()) { /// let start_time = request.local_cache(|| TimerStart(None));
/// let ms = duration.as_secs() * 1000 + duration.subsec_millis() as u64; /// if let Some(Ok(duration)) = start_time.0.map(|st| st.elapsed()) {
/// response.set_raw_header("X-Response-Time", format!("{} ms", ms)); /// let ms = duration.as_secs() * 1000 + duration.subsec_millis() as u64;
/// } /// response.set_raw_header("X-Response-Time", format!("{} ms", ms));
/// }
/// })
/// } /// }
/// } /// }
/// ///

View File

@ -42,15 +42,16 @@ pub type HandlerFuture<'r> = std::pin::Pin<Box<dyn Future<Output = Outcome<'r>>
/// Such a handler might be written and used as follows: /// Such a handler might be written and used as follows:
/// ///
/// ```rust /// ```rust
/// # #![feature(async_await)]
/// # #[derive(Copy, Clone)] enum Kind { Simple, Intermediate, Complex, } /// # #[derive(Copy, Clone)] enum Kind { Simple, Intermediate, Complex, }
/// use rocket::{Request, Data, Route, http::Method}; /// use rocket::{Request, Data, Route, http::Method};
/// use rocket::handler::{self, Handler, Outcome}; /// use rocket::handler::{self, Handler, Outcome, HandlerFuture};
/// ///
/// #[derive(Clone)] /// #[derive(Clone)]
/// struct CustomHandler(Kind); /// struct CustomHandler(Kind);
/// ///
/// impl Handler for CustomHandler { /// impl Handler for CustomHandler {
/// fn handle<'r>(&self, req: &'r Request, data: Data) -> Outcome<'r> { /// fn handle<'r>(&self, req: &'r Request, data: Data) -> HandlerFuture<'r> {
/// match self.0 { /// match self.0 {
/// Kind::Simple => Outcome::from(req, "simple"), /// Kind::Simple => Outcome::from(req, "simple"),
/// Kind::Intermediate => Outcome::from(req, "intermediate"), /// Kind::Intermediate => Outcome::from(req, "intermediate"),
@ -91,7 +92,7 @@ pub type HandlerFuture<'r> = std::pin::Pin<Box<dyn Future<Output = Outcome<'r>>
/// managed state and a static route, as follows: /// managed state and a static route, as follows:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// # #[derive(Copy, Clone)] /// # #[derive(Copy, Clone)]
@ -198,10 +199,11 @@ impl<'r> Outcome<'r> {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # #![feature(async_await)]
/// use rocket::{Request, Data}; /// use rocket::{Request, Data};
/// use rocket::handler::Outcome; /// use rocket::handler::{Outcome, HandlerFuture};
/// ///
/// fn str_responder(req: &Request, _: Data) -> Outcome<'static> { /// fn str_responder<'r>(req: &'r Request, _: Data) -> HandlerFuture<'r> {
/// Outcome::from(req, "Hello, world!") /// Outcome::from(req, "Hello, world!")
/// } /// }
/// ``` /// ```
@ -253,10 +255,11 @@ impl<'r> Outcome<'r> {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # #![feature(async_await)]
/// use rocket::{Request, Data}; /// use rocket::{Request, Data};
/// use rocket::handler::Outcome; /// use rocket::handler::{Outcome, HandlerFuture};
/// ///
/// fn str_responder(req: &Request, data: Data) -> Outcome<'static> { /// fn str_responder<'r>(req: &'r Request, data: Data) -> HandlerFuture<'r> {
/// Outcome::from_or_forward(req, data, "Hello, world!") /// Outcome::from_or_forward(req, data, "Hello, world!")
/// } /// }
/// ``` /// ```
@ -281,12 +284,15 @@ impl<'r> Outcome<'r> {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # #![feature(async_await)]
/// use rocket::{Request, Data}; /// use rocket::{Request, Data};
/// use rocket::handler::Outcome; /// use rocket::handler::{Outcome, HandlerFuture};
/// use rocket::http::Status; /// use rocket::http::Status;
/// ///
/// fn bad_req_route(_: &Request, _: Data) -> Outcome<'static> { /// fn bad_req_route<'r>(_: &'r Request, _: Data) -> HandlerFuture<'r> {
/// Outcome::failure(Status::BadRequest) /// Box::pin(async move {
/// Outcome::failure(Status::BadRequest)
/// })
/// } /// }
/// ``` /// ```
#[inline(always)] #[inline(always)]
@ -303,11 +309,14 @@ impl<'r> Outcome<'r> {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # #![feature(async_await)]
/// use rocket::{Request, Data}; /// use rocket::{Request, Data};
/// use rocket::handler::Outcome; /// use rocket::handler::{Outcome, HandlerFuture};
/// ///
/// fn always_forward(_: &Request, data: Data) -> Outcome<'static> { /// fn always_forward<'r>(_: &'r Request, data: Data) -> HandlerFuture<'r> {
/// Outcome::forward(data) /// Box::pin(async move {
/// Outcome::forward(data)
/// })
/// } /// }
/// ``` /// ```
#[inline(always)] #[inline(always)]

View File

@ -48,7 +48,7 @@
//! Then, add the following to the top of your `main.rs` file: //! Then, add the following to the top of your `main.rs` file:
//! //!
//! ```rust //! ```rust
//! #![feature(proc_macro_hygiene)] //! #![feature(proc_macro_hygiene, async_await)]
//! //!
//! #[macro_use] extern crate rocket; //! #[macro_use] extern crate rocket;
//! # #[get("/")] fn hello() { } //! # #[get("/")] fn hello() { }
@ -59,7 +59,7 @@
//! write Rocket applications. Here's a simple example to get you started: //! write Rocket applications. Here's a simple example to get you started:
//! //!
//! ```rust //! ```rust
//! #![feature(proc_macro_hygiene)] //! #![feature(proc_macro_hygiene, async_await)]
//! //!
//! #[macro_use] extern crate rocket; //! #[macro_use] extern crate rocket;
//! //!

View File

@ -67,7 +67,7 @@
//! consider the following complete "Hello, world!" application, with testing. //! consider the following complete "Hello, world!" application, with testing.
//! //!
//! ```rust //! ```rust
//! #![feature(proc_macro_hygiene)] //! #![feature(proc_macro_hygiene, async_await)]
//! //!
//! #[macro_use] extern crate rocket; //! #[macro_use] extern crate rocket;
//! //!

View File

@ -50,7 +50,7 @@ pub enum FormDataError<'f, E> {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::request::{Form, FormError, FormDataError}; /// use rocket::request::{Form, FormError, FormDataError};
/// ///

View File

@ -33,7 +33,7 @@ use crate::ext::AsyncReadExt as _;
/// implements the `FromForm` trait: /// implements the `FromForm` trait:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::request::Form; /// use rocket::request::Form;
/// use rocket::http::RawStr; /// use rocket::http::RawStr;
@ -69,7 +69,7 @@ use crate::ext::AsyncReadExt as _;
/// A handler that handles a form of this type can similarly by written: /// A handler that handles a form of this type can similarly by written:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #![allow(deprecated, unused_attributes)] /// # #![allow(deprecated, unused_attributes)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # use rocket::request::Form; /// # use rocket::request::Form;
@ -122,7 +122,7 @@ impl<T> Form<T> {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::request::Form; /// use rocket::request::Form;
/// ///

View File

@ -13,7 +13,7 @@ use crate::request::FormItems;
/// validation. /// validation.
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #![allow(deprecated, dead_code, unused_attributes)] /// # #![allow(deprecated, dead_code, unused_attributes)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// #[derive(FromForm)] /// #[derive(FromForm)]
@ -30,7 +30,7 @@ use crate::request::FormItems;
/// data via the `data` parameter and `Form` type. /// data via the `data` parameter and `Form` type.
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #![allow(deprecated, dead_code, unused_attributes)] /// # #![allow(deprecated, dead_code, unused_attributes)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # use rocket::request::Form; /// # use rocket::request::Form;

View File

@ -43,7 +43,7 @@ use crate::http::RawStr;
/// according to its target type: /// according to its target type:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # type Size = String; /// # type Size = String;
/// #[get("/item?<id>&<size>")] /// #[get("/item?<id>&<size>")]

View File

@ -31,7 +31,7 @@ use crate::http::uri::{Query, FromUriParam};
/// handler: /// handler:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::request::LenientForm; /// use rocket::request::LenientForm;
/// ///
@ -67,7 +67,7 @@ impl<T> LenientForm<T> {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::request::LenientForm; /// use rocket::request::LenientForm;
/// ///

View File

@ -55,7 +55,7 @@ impl<S, E> IntoOutcome<S, (Status, E), ()> for Result<S, E> {
/// guard. /// guard.
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # use rocket::http::Method; /// # use rocket::http::Method;
/// # type A = Method; type B = Method; type C = Method; type T = (); /// # type A = Method; type B = Method; type C = Method; type T = ();
@ -165,7 +165,7 @@ impl<S, E> IntoOutcome<S, (Status, E), ()> for Result<S, E> {
/// `sensitive` handler. /// `sensitive` handler.
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// use rocket::Outcome; /// use rocket::Outcome;
@ -220,7 +220,7 @@ impl<S, E> IntoOutcome<S, (Status, E), ()> for Result<S, E> {
/// routes (`admin_dashboard` and `user_dashboard`): /// routes (`admin_dashboard` and `user_dashboard`):
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # #[cfg(feature = "private-cookies")] mod inner { /// # #[cfg(feature = "private-cookies")] mod inner {
/// # use rocket::outcome::{IntoOutcome, Outcome}; /// # use rocket::outcome::{IntoOutcome, Outcome};
@ -283,7 +283,7 @@ impl<S, E> IntoOutcome<S, (Status, E), ()> for Result<S, E> {
/// used, as illustrated below: /// used, as illustrated below:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # #[cfg(feature = "private-cookies")] mod inner { /// # #[cfg(feature = "private-cookies")] mod inner {
/// # use rocket::outcome::{IntoOutcome, Outcome}; /// # use rocket::outcome::{IntoOutcome, Outcome};

View File

@ -19,7 +19,7 @@ use crate::http::{RawStr, uri::{Segments, SegmentError}};
/// handler for the dynamic `"/<id>"` path: /// handler for the dynamic `"/<id>"` path:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// #[get("/<id>")] /// #[get("/<id>")]
/// fn hello(id: usize) -> String { /// fn hello(id: usize) -> String {
@ -54,7 +54,7 @@ use crate::http::{RawStr, uri::{Segments, SegmentError}};
/// parameter as follows: /// parameter as follows:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # use rocket::http::RawStr; /// # use rocket::http::RawStr;
/// #[get("/<id>")] /// #[get("/<id>")]
@ -172,7 +172,7 @@ use crate::http::{RawStr, uri::{Segments, SegmentError}};
/// dynamic path segment: /// dynamic path segment:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # use rocket::request::FromParam; /// # use rocket::request::FromParam;
/// # use rocket::http::RawStr; /// # use rocket::http::RawStr;

View File

@ -8,7 +8,7 @@ use crate::request::{FormItems, FormItem, Form, LenientForm, FromForm};
/// generation for every trailing query parameter, `<params..>` below: /// generation for every trailing query parameter, `<params..>` below:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// # use rocket::request::Form; /// # use rocket::request::Form;
@ -82,7 +82,7 @@ impl<'q> Iterator for Query<'q> {
/// route: /// route:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::request::Form; /// use rocket::request::Form;
/// ///

View File

@ -22,7 +22,7 @@ use crate::http::Status;
/// following example does just this: /// following example does just this:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::State; /// use rocket::State;
/// ///
@ -87,7 +87,7 @@ use crate::http::Status;
/// [`State::from()`] static method: /// [`State::from()`] static method:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::State; /// use rocket::State;
/// ///

View File

@ -45,7 +45,7 @@ const FLASH_COOKIE_NAME: &str = "_flash";
/// message on both the request and response sides. /// message on both the request and response sides.
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::response::{Flash, Redirect}; /// use rocket::response::{Flash, Redirect};
/// use rocket::request::FlashMessage; /// use rocket::request::FlashMessage;

View File

@ -26,7 +26,7 @@ use crate::http::Status;
/// a route, _always_ use [`uri!`] to construct a valid [`Origin`]: /// a route, _always_ use [`uri!`] to construct a valid [`Origin`]:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::response::Redirect; /// use rocket::response::Redirect;
/// ///

View File

@ -13,7 +13,7 @@ use crate::request::Request;
/// as illustrated below with `T`: /// as illustrated below with `T`:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # type T = (); /// # type T = ();
/// # /// #
@ -154,7 +154,7 @@ use crate::request::Request;
/// following `Responder` implementation accomplishes this: /// following `Responder` implementation accomplishes this:
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// # #[derive(Debug)] /// # #[derive(Debug)]
@ -166,14 +166,16 @@ use crate::request::Request;
/// use rocket::response::{self, Response, Responder}; /// use rocket::response::{self, Response, Responder};
/// use rocket::http::ContentType; /// use rocket::http::ContentType;
/// ///
/// impl Responder<'_> for Person { /// impl Responder<'r> for Person {
/// fn respond_to(self, _: &Request) -> response::Result<'static> { /// fn respond_to(self, _: &'r Request) -> response::ResultFuture<'r> {
/// Response::build() /// Box::pin(async move {
/// .sized_body(Cursor::new(format!("{}:{}", self.name, self.age))) /// Response::build()
/// .raw_header("X-Person-Name", self.name) /// .sized_body(Cursor::new(format!("{}:{}", self.name, self.age)))
/// .raw_header("X-Person-Age", self.age.to_string()) /// .raw_header("X-Person-Name", self.name)
/// .header(ContentType::new("application", "x-person")) /// .raw_header("X-Person-Age", self.age.to_string())
/// .ok() /// .header(ContentType::new("application", "x-person"))
/// .ok()
/// })
/// } /// }
/// } /// }
/// # /// #

View File

@ -513,7 +513,7 @@ impl Rocket {
/// dispatched to the `hi` route. /// dispatched to the `hi` route.
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// # /// #
/// #[get("/world")] /// #[get("/world")]
@ -535,10 +535,10 @@ impl Rocket {
/// ///
/// ```rust /// ```rust
/// use rocket::{Request, Route, Data}; /// use rocket::{Request, Route, Data};
/// use rocket::handler::Outcome; /// use rocket::handler::{HandlerFuture, Outcome};
/// use rocket::http::Method::*; /// use rocket::http::Method::*;
/// ///
/// fn hi<'r>(req: &'r Request, _: Data) -> Outcome<'r> { /// fn hi<'r>(req: &'r Request, _: Data) -> HandlerFuture<'r> {
/// Outcome::from(req, "Hello!") /// Outcome::from(req, "Hello!")
/// } /// }
/// ///
@ -585,7 +585,7 @@ impl Rocket {
/// # Examples /// # Examples
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::Request; /// use rocket::Request;
/// ///
@ -641,7 +641,7 @@ impl Rocket {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::State; /// use rocket::State;
/// ///
@ -678,7 +678,7 @@ impl Rocket {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::Rocket; /// use rocket::Rocket;
/// use rocket::fairing::AdHoc; /// use rocket::fairing::AdHoc;
@ -819,7 +819,7 @@ impl Rocket {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::Rocket; /// use rocket::Rocket;
/// use rocket::fairing::AdHoc; /// use rocket::fairing::AdHoc;
@ -875,7 +875,7 @@ impl Rocket {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// # #![feature(proc_macro_hygiene)] /// # #![feature(proc_macro_hygiene, async_await)]
/// # #[macro_use] extern crate rocket; /// # #[macro_use] extern crate rocket;
/// use rocket::Rocket; /// use rocket::Rocket;
/// use rocket::fairing::AdHoc; /// use rocket::fairing::AdHoc;

View File

@ -108,8 +108,8 @@ impl Route {
/// use rocket::Route; /// use rocket::Route;
/// use rocket::http::Method; /// use rocket::http::Method;
/// # use rocket::{Request, Data}; /// # use rocket::{Request, Data};
/// # use rocket::handler::Outcome; /// # use rocket::handler::{Outcome, HandlerFuture};
/// # fn handler<'r>(request: &'r Request, _data: Data) -> Outcome<'r> { /// # fn handler<'r>(request: &'r Request, _data: Data) -> HandlerFuture<'r> {
/// # Outcome::from(request, "Hello, world!") /// # Outcome::from(request, "Hello, world!")
/// # } /// # }
/// ///
@ -158,8 +158,8 @@ impl Route {
/// use rocket::Route; /// use rocket::Route;
/// use rocket::http::Method; /// use rocket::http::Method;
/// # use rocket::{Request, Data}; /// # use rocket::{Request, Data};
/// # use rocket::handler::Outcome; /// # use rocket::handler::{Outcome, HandlerFuture};
/// # fn handler<'r>(request: &'r Request, _data: Data) -> Outcome<'r> { /// # fn handler<'r>(request: &'r Request, _data: Data) -> HandlerFuture<'r> {
/// # Outcome::from(request, "Hello, world!") /// # Outcome::from(request, "Hello, world!")
/// # } /// # }
/// ///
@ -208,9 +208,9 @@ impl Route {
/// use rocket::Route; /// use rocket::Route;
/// use rocket::http::Method; /// use rocket::http::Method;
/// # use rocket::{Request, Data}; /// # use rocket::{Request, Data};
/// # use rocket::handler::Outcome; /// # use rocket::handler::{Outcome, HandlerFuture};
/// # /// #
/// # fn handler<'r>(request: &'r Request, _data: Data) -> Outcome<'r> { /// # fn handler<'r>(request: &'r Request, _data: Data) -> HandlerFuture<'r> {
/// # Outcome::from(request, "Hello, world!") /// # Outcome::from(request, "Hello, world!")
/// # } /// # }
/// ///
@ -242,9 +242,9 @@ impl Route {
/// use rocket::Route; /// use rocket::Route;
/// use rocket::http::{Method, uri::Origin}; /// use rocket::http::{Method, uri::Origin};
/// # use rocket::{Request, Data}; /// # use rocket::{Request, Data};
/// # use rocket::handler::Outcome; /// # use rocket::handler::{Outcome, HandlerFuture};
/// # /// #
/// # fn handler<'r>(request: &'r Request, _data: Data) -> Outcome<'r> { /// # fn handler<'r>(request: &'r Request, _data: Data) -> HandlerFuture<'r> {
/// # Outcome::from(request, "Hello, world!") /// # Outcome::from(request, "Hello, world!")
/// # } /// # }
/// ///