Rename 'rocket::ignite()' to 'rocket::build()'.

...because loading up a Rocket while it's ignited is a bad idea.

More seriously, because 'Rocket.ignite()' will become an "execute
everything up to here" method.
This commit is contained in:
Sergio Benitez 2021-04-08 01:07:52 -07:00
parent 50c9e88cf9
commit ad36b769bc
96 changed files with 203 additions and 203 deletions

View File

@ -19,7 +19,7 @@ fn hello(name: &str, age: u8) -> String {
#[launch] #[launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/hello", routes![hello]) rocket::build().mount("/hello", routes![hello])
} }
``` ```

View File

@ -60,7 +60,7 @@ impl Default for Context {
/// use rocket_contrib::compression::Compression; /// use rocket_contrib::compression::Compression;
/// ///
/// fn main() { /// fn main() {
/// rocket::ignite() /// rocket::build()
/// // ... /// // ...
/// .attach(Compression::fairing()) /// .attach(Compression::fairing())
/// // ... /// // ...
@ -83,7 +83,7 @@ impl Compression {
/// use rocket_contrib::compression::Compression; /// use rocket_contrib::compression::Compression;
/// ///
/// fn main() { /// fn main() {
/// rocket::ignite() /// rocket::build()
/// // ... /// // ...
/// .attach(Compression::fairing()) /// .attach(Compression::fairing())
/// // ... /// // ...

View File

@ -64,7 +64,7 @@
//! //!
//! #[launch] //! #[launch]
//! fn rocket() -> rocket::Rocket { //! fn rocket() -> rocket::Rocket {
//! rocket::ignite().attach(LogsDbConn::fairing()) //! rocket::build().attach(LogsDbConn::fairing())
//! } //! }
//! # } fn main() {} //! # } fn main() {}
//! ``` //! ```

View File

@ -45,7 +45,7 @@ use crate::helmet::*;
/// # extern crate rocket_contrib; /// # extern crate rocket_contrib;
/// # use rocket_contrib::helmet::SpaceHelmet; /// # use rocket_contrib::helmet::SpaceHelmet;
/// # let helmet = SpaceHelmet::default(); /// # let helmet = SpaceHelmet::default();
/// rocket::ignite() /// rocket::build()
/// // ... /// // ...
/// .attach(helmet) /// .attach(helmet)
/// # ; /// # ;

View File

@ -65,7 +65,7 @@
//! # extern crate rocket_contrib; //! # extern crate rocket_contrib;
//! use rocket_contrib::helmet::SpaceHelmet; //! use rocket_contrib::helmet::SpaceHelmet;
//! //!
//! let rocket = rocket::ignite().attach(SpaceHelmet::default()); //! let rocket = rocket::build().attach(SpaceHelmet::default());
//! ``` //! ```
//! //!
//! Each header can be configured individually. To enable a particular header, //! Each header can be configured individually. To enable a particular header,

View File

@ -204,7 +204,7 @@ impl std::ops::BitOr for Options {
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite().mount("/public", StaticFiles::from("/static")) /// rocket::build().mount("/public", StaticFiles::from("/static"))
/// } /// }
/// ``` /// ```
/// ///
@ -228,7 +228,7 @@ impl std::ops::BitOr for Options {
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite().mount("/", StaticFiles::from(crate_relative!("static"))) /// rocket::build().mount("/", StaticFiles::from(crate_relative!("static")))
/// } /// }
/// ``` /// ```
#[derive(Clone)] #[derive(Clone)]
@ -264,7 +264,7 @@ impl StaticFiles {
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite().mount("/static", StaticFiles::from("/www/public")) /// rocket::build().mount("/static", StaticFiles::from("/www/public"))
/// } /// }
/// ``` /// ```
/// ///
@ -277,7 +277,7 @@ impl StaticFiles {
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite().mount("/static", StaticFiles::from("/www/public").rank(30)) /// rocket::build().mount("/static", StaticFiles::from("/www/public").rank(30))
/// } /// }
/// ``` /// ```
pub fn from<P: AsRef<Path>>(path: P) -> Self { pub fn from<P: AsRef<Path>>(path: P) -> Self {
@ -307,7 +307,7 @@ impl StaticFiles {
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// let options = Options::Index | Options::DotFiles; /// let options = Options::Index | Options::DotFiles;
/// rocket::ignite() /// rocket::build()
/// .mount("/static", StaticFiles::from("/www/public")) /// .mount("/static", StaticFiles::from("/www/public"))
/// .mount("/pub", StaticFiles::new("/www/public", options).rank(-1)) /// .mount("/pub", StaticFiles::new("/www/public", options).rank(-1))
/// } /// }

View File

@ -37,7 +37,7 @@ pub(crate) trait Engine: Send + Sync + 'static {
/// } /// }
/// ///
/// fn main() { /// fn main() {
/// rocket::ignite() /// rocket::build()
/// // ... /// // ...
/// .attach(Template::custom(|engines: &mut Engines| { /// .attach(Template::custom(|engines: &mut Engines| {
/// engines.tera.register_filter("my_filter", my_filter); /// engines.tera.register_filter("my_filter", my_filter);

View File

@ -30,7 +30,7 @@ use crate::templates::ContextManager;
/// ///
/// ///
/// fn main() { /// fn main() {
/// rocket::ignite() /// rocket::build()
/// .attach(Template::fairing()) /// .attach(Template::fairing())
/// // ... /// // ...
/// # ; /// # ;

View File

@ -26,7 +26,7 @@
//! use rocket_contrib::templates::Template; //! use rocket_contrib::templates::Template;
//! //!
//! fn main() { //! fn main() {
//! rocket::ignite() //! rocket::build()
//! .attach(Template::fairing()) //! .attach(Template::fairing())
//! // ... //! // ...
//! # ; //! # ;
@ -169,7 +169,7 @@ const DEFAULT_TEMPLATE_DIR: &str = "templates";
/// use rocket_contrib::templates::Template; /// use rocket_contrib::templates::Template;
/// ///
/// fn main() { /// fn main() {
/// rocket::ignite() /// rocket::build()
/// .attach(Template::fairing()) /// .attach(Template::fairing())
/// // ... /// // ...
/// # ; /// # ;
@ -237,7 +237,7 @@ impl Template {
/// use rocket_contrib::templates::Template; /// use rocket_contrib::templates::Template;
/// ///
/// fn main() { /// fn main() {
/// rocket::ignite() /// rocket::build()
/// // ... /// // ...
/// .attach(Template::fairing()) /// .attach(Template::fairing())
/// // ... /// // ...
@ -266,7 +266,7 @@ impl Template {
/// use rocket_contrib::templates::Template; /// use rocket_contrib::templates::Template;
/// ///
/// fn main() { /// fn main() {
/// rocket::ignite() /// rocket::build()
/// // ... /// // ...
/// .attach(Template::custom(|engines| { /// .attach(Template::custom(|engines| {
/// // engines.handlebars.register_helper ... /// // engines.handlebars.register_helper ...
@ -297,7 +297,7 @@ impl Template {
/// use rocket_contrib::templates::Template; /// use rocket_contrib::templates::Template;
/// ///
/// fn main() { /// fn main() {
/// rocket::ignite() /// rocket::build()
/// // ... /// // ...
/// .attach(Template::try_custom(|engines| { /// .attach(Template::try_custom(|engines| {
/// // engines.handlebars.register_helper ... /// // engines.handlebars.register_helper ...
@ -361,7 +361,7 @@ impl Template {
/// use rocket::local::blocking::Client; /// use rocket::local::blocking::Client;
/// ///
/// fn main() { /// fn main() {
/// let rocket = rocket::ignite().attach(Template::fairing()); /// let rocket = rocket::build().attach(Template::fairing());
/// let client = Client::untracked(rocket).expect("valid rocket"); /// let client = Client::untracked(rocket).expect("valid rocket");
/// ///
/// // Create a `context`. Here, just an empty `HashMap`. /// // Create a `context`. Here, just an empty `HashMap`.

View File

@ -61,7 +61,7 @@ mod compress_responder_tests {
} }
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", routes![index, font, image, already_encoded, identity]) rocket::build().mount("/", routes![index, font, image, already_encoded, identity])
} }
#[test] #[test]

View File

@ -63,7 +63,7 @@ mod compression_fairing_tests {
} }
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite() rocket::build()
.mount( .mount(
"/", "/",
routes![index, font, image, tar, already_encoded, identity], routes![index, font, image, tar, already_encoded, identity],

View File

@ -31,7 +31,7 @@ mod helmet_tests {
macro_rules! dispatch { macro_rules! dispatch {
($helmet:expr, $closure:expr) => {{ ($helmet:expr, $closure:expr) => {{
let rocket = rocket::ignite().mount("/", routes![hello]).attach($helmet); let rocket = rocket::build().mount("/", routes![hello]).attach($helmet);
let client = Client::debug(rocket).unwrap(); let client = Client::debug(rocket).unwrap();
let response = client.get("/").dispatch(); let response = client.get("/").dispatch();
assert_eq!(response.status(), Status::Ok); assert_eq!(response.status(), Status::Ok);

View File

@ -14,7 +14,7 @@ mod static_tests {
fn rocket() -> Rocket { fn rocket() -> Rocket {
let root = static_root(); let root = static_root();
rocket::ignite() rocket::build()
.mount("/default", StaticFiles::from(&root)) .mount("/default", StaticFiles::from(&root))
.mount("/no_index", StaticFiles::new(&root, Options::None)) .mount("/no_index", StaticFiles::new(&root, Options::None))
.mount("/dots", StaticFiles::new(&root, Options::DotFiles)) .mount("/dots", StaticFiles::new(&root, Options::DotFiles))

View File

@ -36,7 +36,7 @@ mod templates_tests {
fn test_callback_error() { fn test_callback_error() {
use rocket::{local::blocking::Client, error::ErrorKind::FailedFairings}; use rocket::{local::blocking::Client, error::ErrorKind::FailedFairings};
let rocket = rocket::ignite().attach(Template::try_custom(|_| { let rocket = rocket::build().attach(Template::try_custom(|_| {
Err("error reloading templates!".into()) Err("error reloading templates!".into())
})); }));

View File

@ -30,7 +30,7 @@
//! ```rust //! ```rust
//! #[macro_use] extern crate rocket; //! #[macro_use] extern crate rocket;
//! # #[get("/")] fn hello() { } //! # #[get("/")] fn hello() { }
//! # fn main() { rocket::ignite().mount("/", routes![hello]); } //! # fn main() { rocket::build().mount("/", routes![hello]); }
//! ``` //! ```
//! //!
//! Or, alternatively, selectively import from the top-level scope: //! Or, alternatively, selectively import from the top-level scope:
@ -40,7 +40,7 @@
//! //!
//! use rocket::{get, routes}; //! use rocket::{get, routes};
//! # #[get("/")] fn hello() { } //! # #[get("/")] fn hello() { }
//! # fn main() { rocket::ignite().mount("/", routes![hello]); } //! # fn main() { rocket::build().mount("/", routes![hello]); }
//! ``` //! ```
//! //!
//! # Debugging Codegen //! # Debugging Codegen

View File

@ -4,8 +4,8 @@ mod a {
// async launch that is async. // async launch that is async.
#[rocket::launch] #[rocket::launch]
async fn rocket() -> rocket::Rocket { async fn rocket() -> rocket::Rocket {
let _ = rocket::ignite().launch().await; let _ = rocket::build().launch().await;
rocket::ignite() rocket::build()
} }
async fn use_it() { async fn use_it() {
@ -17,7 +17,7 @@ mod b {
// async launch that isn't async. // async launch that isn't async.
#[rocket::launch] #[rocket::launch]
async fn main2() -> rocket::Rocket { async fn main2() -> rocket::Rocket {
rocket::ignite() rocket::build()
} }
async fn use_it() { async fn use_it() {
@ -27,7 +27,7 @@ mod b {
mod b_inferred { mod b_inferred {
#[rocket::launch] #[rocket::launch]
async fn main2() -> _ { rocket::ignite() } async fn main2() -> _ { rocket::build() }
async fn use_it() { async fn use_it() {
let rocket: rocket::Rocket = main2().await; let rocket: rocket::Rocket = main2().await;
@ -38,7 +38,7 @@ mod c {
// non-async launch. // non-async launch.
#[rocket::launch] #[rocket::launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite() rocket::build()
} }
fn use_it() { fn use_it() {
@ -48,7 +48,7 @@ mod c {
mod c_inferred { mod c_inferred {
#[rocket::launch] #[rocket::launch]
fn rocket() -> _ { rocket::ignite() } fn rocket() -> _ { rocket::build() }
fn use_it() { fn use_it() {
let rocket: rocket::Rocket = rocket(); let rocket: rocket::Rocket = rocket();
@ -59,7 +59,7 @@ mod d {
// main with async, is async. // main with async, is async.
#[rocket::main] #[rocket::main]
async fn main() { async fn main() {
let _ = rocket::ignite().launch().await; let _ = rocket::build().launch().await;
} }
} }
@ -73,7 +73,7 @@ mod f {
// main with async, is async, with termination return. // main with async, is async, with termination return.
#[rocket::main] #[rocket::main]
async fn main() -> Result<(), String> { async fn main() -> Result<(), String> {
let result = rocket::ignite().launch().await; let result = rocket::build().launch().await;
result.map_err(|e| e.to_string()) result.map_err(|e| e.to_string())
} }
} }
@ -89,6 +89,6 @@ mod g {
// main with async, is async, with termination return. // main with async, is async, with termination return.
#[rocket::main] #[rocket::main]
async fn main() -> Result<(), String> { async fn main() -> Result<(), String> {
let result = rocket::ignite().launch().await; let result = rocket::build().launch().await;
result.map_err(|e| e.to_string()) result.map_err(|e| e.to_string())
} }

View File

@ -33,7 +33,7 @@ foo!("/hello/<name>", name);
#[test] #[test]
fn test_reexpansion() { fn test_reexpansion() {
let rocket = rocket::ignite().mount("/", routes![easy, hard, hi]); let rocket = rocket::build().mount("/", routes![easy, hard, hi]);
let client = Client::debug(rocket).unwrap(); let client = Client::debug(rocket).unwrap();
let response = client.get("/easy/327").dispatch(); let response = client.get("/easy/327").dispatch();
@ -59,7 +59,7 @@ index!(i32);
#[test] #[test]
fn test_index() { fn test_index() {
let rocket = rocket::ignite().mount("/", routes![index]).manage(100i32); let rocket = rocket::build().mount("/", routes![index]).manage(100i32);
let client = Client::debug(rocket).unwrap(); let client = Client::debug(rocket).unwrap();
let response = client.get("/").dispatch(); let response = client.get("/").dispatch();

View File

@ -32,7 +32,7 @@ fn simple<'r>(simple: Simple<'r>) -> &'r str { simple.0 }
#[test] #[test]
fn test_data() { fn test_data() {
let rocket = rocket::ignite().mount("/", routes![form, simple]); let rocket = rocket::build().mount("/", routes![form, simple]);
let client = Client::debug(rocket).unwrap(); let client = Client::debug(rocket).unwrap();
let response = client.post("/f") let response = client.post("/f")

View File

@ -33,7 +33,7 @@ fn other() -> &'static str { "other" }
#[test] #[test]
fn test_formats() { fn test_formats() {
let rocket = rocket::ignite() let rocket = rocket::build()
.mount("/", routes![json, xml, json_long, msgpack_long, msgpack, .mount("/", routes![json, xml, json_long, msgpack_long, msgpack,
plain, binary, other]); plain, binary, other]);
@ -84,7 +84,7 @@ fn put_bar_baz() -> &'static str { "put_bar_baz" }
#[test] #[test]
fn test_custom_formats() { fn test_custom_formats() {
let rocket = rocket::ignite() let rocket = rocket::build()
.mount("/", routes![get_foo, post_foo, get_bar_baz, put_bar_baz]); .mount("/", routes![get_foo, post_foo, get_bar_baz, put_bar_baz]);
let client = Client::debug(rocket).unwrap(); let client = Client::debug(rocket).unwrap();

View File

@ -18,7 +18,7 @@ fn get3(_number: u64) -> &'static str { "3" }
#[test] #[test]
fn test_ranking() { fn test_ranking() {
let rocket = rocket::ignite().mount("/", routes![get0, get1, get2, get3]); let rocket = rocket::build().mount("/", routes![get0, get1, get2, get3]);
let client = Client::debug(rocket).unwrap(); let client = Client::debug(rocket).unwrap();
let response = client.get("/0").dispatch(); let response = client.get("/0").dispatch();
@ -43,7 +43,7 @@ fn get0b(_n: u8) { }
fn test_rank_collision() { fn test_rank_collision() {
use rocket::error::ErrorKind; use rocket::error::ErrorKind;
let rocket = rocket::ignite().mount("/", routes![get0, get0b]); let rocket = rocket::build().mount("/", routes![get0, get0b]);
let client_result = Client::debug(rocket); let client_result = Client::debug(rocket);
match client_result.as_ref().map_err(|e| e.kind()) { match client_result.as_ref().map_err(|e| e.kind()) {
Err(ErrorKind::Collisions(..)) => { /* o.k. */ }, Err(ErrorKind::Collisions(..)) => { /* o.k. */ },

View File

@ -21,7 +21,7 @@ fn catch(r#raw: &rocket::Request) -> String {
#[test] #[test]
fn test_raw_ident() { fn test_raw_ident() {
let rocket = rocket::ignite() let rocket = rocket::build()
.mount("/", routes![get, swap]) .mount("/", routes![get, swap])
.register("/", catchers![catch]); .register("/", catchers![catch]);

View File

@ -83,7 +83,7 @@ fn test_unused_params(_unused_param: String, _unused_query: String, _unused_data
#[test] #[test]
fn test_full_route() { fn test_full_route() {
let rocket = rocket::ignite() let rocket = rocket::build()
.mount("/1", routes![post1]) .mount("/1", routes![post1])
.mount("/2", routes![post2]); .mount("/2", routes![post2]);
@ -145,7 +145,7 @@ mod scopes {
use other::world; use other::world;
fn _rocket() -> rocket::Rocket { fn _rocket() -> rocket::Rocket {
rocket::ignite().mount("/", rocket::routes![hello, world]) rocket::build().mount("/", rocket::routes![hello, world])
} }
} }
@ -170,7 +170,7 @@ fn filtered_raw_query(bird: usize, color: &str, rest: Contextual<'_, Filtered<'_
#[test] #[test]
fn test_filtered_raw_query() { fn test_filtered_raw_query() {
let rocket = rocket::ignite().mount("/", routes![filtered_raw_query]); let rocket = rocket::build().mount("/", routes![filtered_raw_query]);
let client = Client::debug(rocket).unwrap(); let client = Client::debug(rocket).unwrap();
#[track_caller] #[track_caller]
@ -290,10 +290,10 @@ fn test_query_collection() {
assert_eq!(run(&client, colors, dog).1, "blue&green&blue - Max Fido - 10"); assert_eq!(run(&client, colors, dog).1, "blue&green&blue - Max Fido - 10");
} }
let rocket = rocket::ignite().mount("/", routes![query_collection]); let rocket = rocket::build().mount("/", routes![query_collection]);
run_tests(rocket); run_tests(rocket);
let rocket = rocket::ignite().mount("/", routes![query_collection_2]); let rocket = rocket::build().mount("/", routes![query_collection_2]);
run_tests(rocket); run_tests(rocket);
} }
@ -323,7 +323,7 @@ fn segments_empty(path: PathString) -> String {
#[test] #[test]
fn test_inclusive_segments() { fn test_inclusive_segments() {
let rocket = rocket::ignite() let rocket = rocket::build()
.mount("/", routes![segments]) .mount("/", routes![segments])
.mount("/", routes![segments_empty]); .mount("/", routes![segments_empty]);

View File

@ -23,7 +23,7 @@ fn test_ignored_segments() {
client.get(url).dispatch().into_string().unwrap() client.get(url).dispatch().into_string().unwrap()
} }
let rocket = rocket::ignite().mount("/", routes![ let rocket = rocket::build().mount("/", routes![
ig_1, just_static, ig_2, ig_3, ig_1_static, ig_1_static_static, wrapped ig_1, just_static, ig_2, ig_3, ig_1_static, ig_1_static_static, wrapped
]); ]);

View File

@ -110,14 +110,14 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks
| |
74 | fn rocket() -> rocket::Rocket { 74 | fn rocket() -> rocket::Rocket {
| ------ this is not `async` | ------ this is not `async`
75 | let _ = rocket::ignite().launch().await; 75 | let _ = rocket::build().launch().await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/async-entry.rs:37:9 --> $DIR/async-entry.rs:37:9
| |
37 | rocket::ignite() 37 | rocket::build()
| ^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `Rocket` | ^^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `Rocket`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/async-entry.rs:46:9 --> $DIR/async-entry.rs:46:9
@ -132,7 +132,7 @@ error[E0308]: mismatched types
| ^ expected `()` because of default return type | ^ expected `()` because of default return type
| _____________________| | _____________________|
| | | |
27 | | rocket::ignite() 27 | | rocket::build()
28 | | } 28 | | }
| | ^- help: consider using a semicolon here: `;` | | ^- help: consider using a semicolon here: `;`
| |_____| | |_____|

View File

@ -104,14 +104,14 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks
| |
74 | fn rocket() -> rocket::Rocket { 74 | fn rocket() -> rocket::Rocket {
| ------ this is not `async` | ------ this is not `async`
75 | let _ = rocket::ignite().launch().await; 75 | let _ = rocket::build().launch().await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/async-entry.rs:37:9 --> $DIR/async-entry.rs:37:9
| |
37 | rocket::ignite() 37 | rocket::build()
| ^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `Rocket` | ^^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `Rocket`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/async-entry.rs:46:9 --> $DIR/async-entry.rs:46:9
@ -126,7 +126,7 @@ error[E0308]: mismatched types
| ^ expected `()` because of default return type | ^ expected `()` because of default return type
| _____________________| | _____________________|
| | | |
27 | | rocket::ignite() 27 | | rocket::build()
28 | | } 28 | | }
| | ^- help: try adding a semicolon: `;` | | ^- help: try adding a semicolon: `;`
| |_____| | |_____|

View File

@ -17,14 +17,14 @@ mod main_b {
mod main_d { mod main_d {
#[rocket::main] #[rocket::main]
fn main() { fn main() {
let _ = rocket::ignite().launch().await; let _ = rocket::build().launch().await;
} }
} }
mod main_f { mod main_f {
#[rocket::main] #[rocket::main]
async fn main() { async fn main() {
rocket::ignite() rocket::build()
} }
} }
@ -33,8 +33,8 @@ mod main_f {
mod launch_a { mod launch_a {
#[rocket::launch] #[rocket::launch]
async fn rocket() -> String { async fn rocket() -> String {
let _ = rocket::ignite().launch().await; let _ = rocket::build().launch().await;
rocket::ignite() rocket::build()
} }
} }
@ -42,7 +42,7 @@ mod launch_a {
mod launch_b { mod launch_b {
#[rocket::launch] #[rocket::launch]
async fn rocket() -> rocket::Rocket { async fn rocket() -> rocket::Rocket {
let _ = rocket::ignite().launch().await; let _ = rocket::build().launch().await;
"hi".to_string() "hi".to_string()
} }
} }
@ -50,37 +50,37 @@ mod launch_b {
mod launch_c { mod launch_c {
#[rocket::launch] #[rocket::launch]
fn main() -> rocket::Rocket { fn main() -> rocket::Rocket {
rocket::ignite() rocket::build()
} }
} }
mod launch_d { mod launch_d {
#[rocket::launch] #[rocket::launch]
async fn rocket() { async fn rocket() {
let _ = rocket::ignite().launch().await; let _ = rocket::build().launch().await;
rocket::ignite() rocket::build()
} }
} }
mod launch_e { mod launch_e {
#[rocket::launch] #[rocket::launch]
fn rocket() { fn rocket() {
rocket::ignite() rocket::build()
} }
} }
mod launch_f { mod launch_f {
#[rocket::launch] #[rocket::launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
let _ = rocket::ignite().launch().await; let _ = rocket::build().launch().await;
rocket::ignite() rocket::build()
} }
} }
mod launch_g { mod launch_g {
#[rocket::launch] #[rocket::launch]
fn main() -> &'static str { fn main() -> &'static str {
let _ = rocket::ignite().launch().await; let _ = rocket::build().launch().await;
"hi" "hi"
} }
} }
@ -88,11 +88,11 @@ mod launch_g {
mod launch_h { mod launch_h {
#[rocket::launch] #[rocket::launch]
async fn main() -> rocket::Rocket { async fn main() -> rocket::Rocket {
rocket::ignite() rocket::build()
} }
} }
#[rocket::main] #[rocket::main]
async fn main() -> rocket::Rocket { async fn main() -> rocket::Rocket {
rocket::ignite() rocket::build()
} }

View File

@ -88,7 +88,7 @@ pub(crate) fn dummy<'r>(_: Status, _: &'r Request<'_>) -> ErrorHandlerFuture<'r>
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite().register("/", catchers![internal_error, not_found, default]) /// rocket::build().register("/", catchers![internal_error, not_found, default])
/// } /// }
/// ``` /// ```
/// ///
@ -293,7 +293,7 @@ impl Default for Catcher {
/// ///
/// #[rocket::launch] /// #[rocket::launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite() /// rocket::build()
/// // to handle only `404` /// // to handle only `404`
/// .register("/", CustomHandler::catch(Status::NotFound, Kind::Simple)) /// .register("/", CustomHandler::catch(Status::NotFound, Kind::Simple))
/// // or to register as the default /// // or to register as the default

View File

@ -192,7 +192,7 @@ impl Config {
} }
} }
/// Returns the default provider figment used by [`rocket::ignite()`]. /// Returns the default provider figment used by [`rocket::build()`].
/// ///
/// The default figment reads from the following sources, in ascending /// The default figment reads from the following sources, in ascending
/// priority order: /// priority order:
@ -205,7 +205,7 @@ impl Config {
/// environment variable. If it is not set, it defaults to `debug` when /// environment variable. If it is not set, it defaults to `debug` when
/// compiled in debug mode and `release` when compiled in release mode. /// compiled in debug mode and `release` when compiled in release mode.
/// ///
/// [`rocket::ignite()`]: crate::ignite() /// [`rocket::build()`]: crate::build()
/// ///
/// # Example /// # Example
/// ///

View File

@ -21,7 +21,7 @@
//! //!
//! #[rocket::launch] //! #[rocket::launch]
//! fn rocket() -> _ { //! fn rocket() -> _ {
//! rocket::ignite().attach(AdHoc::config::<AppConfig>()) //! rocket::build().attach(AdHoc::config::<AppConfig>())
//! } //! }
//! ``` //! ```
//! //!
@ -44,7 +44,7 @@
//! ## Custom Providers //! ## Custom Providers
//! //!
//! A custom provider can be set via [`rocket::custom()`], which replaces calls to //! A custom provider can be set via [`rocket::custom()`], which replaces calls to
//! [`rocket::ignite()`]. The configured provider can be built on top of //! [`rocket::build()`]. The configured provider can be built on top of
//! [`Config::figment()`], [`Config::default()`], both, or neither. The //! [`Config::figment()`], [`Config::default()`], both, or neither. The
//! [Figment](figment) documentation has full details on instantiating existing //! [Figment](figment) documentation has full details on instantiating existing
//! providers like [`Toml`]() and [`Env`] as well as creating custom providers for //! providers like [`Toml`]() and [`Env`] as well as creating custom providers for
@ -107,7 +107,7 @@
//! ``` //! ```
//! //!
//! [`rocket::custom()`]: crate::custom() //! [`rocket::custom()`]: crate::custom()
//! [`rocket::ignite()`]: crate::ignite() //! [`rocket::build()`]: crate::build()
//! [`Toml`]: figment::providers::Toml //! [`Toml`]: figment::providers::Toml
//! [`Env`]: figment::providers::Env //! [`Env`]: figment::providers::Env

View File

@ -23,7 +23,7 @@ use figment::Profile;
/// ///
/// ```rust /// ```rust
/// # let _ = async { /// # let _ = async {
/// if let Err(error) = rocket::ignite().launch().await { /// if let Err(error) = rocket::build().launch().await {
/// // This println "inspects" the error. /// // This println "inspects" the error.
/// println!("Launch failed! Error: {}", error); /// println!("Launch failed! Error: {}", error);
/// ///
@ -38,7 +38,7 @@ use figment::Profile;
/// ///
/// ```rust /// ```rust
/// # let _ = async { /// # let _ = async {
/// let error = rocket::ignite().launch().await; /// let error = rocket::build().launch().await;
/// ///
/// // This call to drop (explicit here for demonstration) will result in /// // This call to drop (explicit here for demonstration) will result in
/// // `error` being pretty-printed to the console along with a `panic!`. /// // `error` being pretty-printed to the console along with a `panic!`.
@ -115,7 +115,7 @@ impl Error {
/// use rocket::error::ErrorKind; /// use rocket::error::ErrorKind;
/// ///
/// # let _ = async { /// # let _ = async {
/// if let Err(error) = rocket::ignite().launch().await { /// if let Err(error) = rocket::build().launch().await {
/// match error.kind() { /// match error.kind() {
/// ErrorKind::Io(e) => println!("found an i/o launch error: {}", e), /// ErrorKind::Io(e) => println!("found an i/o launch error: {}", e),
/// e => println!("something else happened: {}", e) /// e => println!("something else happened: {}", e)

View File

@ -27,7 +27,7 @@ use crate::fairing::{Fairing, Kind, Info};
/// use rocket::fairing::AdHoc; /// use rocket::fairing::AdHoc;
/// use rocket::http::Method; /// use rocket::http::Method;
/// ///
/// rocket::ignite() /// rocket::build()
/// .attach(AdHoc::on_liftoff("Liftoff Printer", |_| Box::pin(async move { /// .attach(AdHoc::on_liftoff("Liftoff Printer", |_| Box::pin(async move {
/// println!("...annnddd we have liftoff!"); /// println!("...annnddd we have liftoff!");
/// }))) /// })))

View File

@ -23,7 +23,7 @@
//! # use rocket::fairing::AdHoc; //! # use rocket::fairing::AdHoc;
//! # let req_fairing = AdHoc::on_request("Request", |_, _| Box::pin(async move {})); //! # let req_fairing = AdHoc::on_request("Request", |_, _| Box::pin(async move {}));
//! # let res_fairing = AdHoc::on_response("Response", |_, _| Box::pin(async move {})); //! # let res_fairing = AdHoc::on_response("Response", |_, _| Box::pin(async move {}));
//! let rocket = rocket::ignite() //! let rocket = rocket::build()
//! .attach(req_fairing) //! .attach(req_fairing)
//! .attach(res_fairing); //! .attach(res_fairing);
//! ``` //! ```

View File

@ -73,7 +73,7 @@ pub type HandlerFuture<'r> = BoxFuture<'r, Outcome<'r>>;
/// ///
/// #[rocket::launch] /// #[rocket::launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite().mount("/", CustomHandler(Kind::Simple)) /// rocket::build().mount("/", CustomHandler(Kind::Simple))
/// } /// }
/// ``` /// ```
/// ///
@ -116,7 +116,7 @@ pub type HandlerFuture<'r> = BoxFuture<'r, Outcome<'r>>;
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite() /// rocket::build()
/// .mount("/", routes![custom_handler]) /// .mount("/", routes![custom_handler])
/// .manage(Kind::Simple) /// .manage(Kind::Simple)
/// } /// }

View File

@ -61,7 +61,7 @@
//! //!
//! #[launch] //! #[launch]
//! fn rocket() -> _ { //! fn rocket() -> _ {
//! rocket::ignite().mount("/", routes![hello]) //! rocket::build().mount("/", routes![hello])
//! } //! }
//! ``` //! ```
//! //!
@ -165,9 +165,9 @@ pub use crate::rocket::Rocket;
pub use crate::shutdown::Shutdown; pub use crate::shutdown::Shutdown;
pub use crate::state::State; pub use crate::state::State;
/// Creates a new instance of `Rocket`: aliases [`Rocket::ignite()`]. /// Creates a new instance of `Rocket`: aliases [`Rocket::build()`].
pub fn ignite() -> Rocket { pub fn build() -> Rocket {
Rocket::ignite() Rocket::build()
} }
/// Creates a new instance of `Rocket` with a custom configuration provider: /// Creates a new instance of `Rocket` with a custom configuration provider:

View File

@ -40,7 +40,7 @@ use crate::error::Error;
/// use rocket::local::asynchronous::Client; /// use rocket::local::asynchronous::Client;
/// ///
/// # rocket::async_test(async { /// # rocket::async_test(async {
/// let rocket = rocket::ignite(); /// let rocket = rocket::build();
/// let client = Client::tracked(rocket).await.expect("valid rocket"); /// let client = Client::tracked(rocket).await.expect("valid rocket");
/// let response = client.post("/") /// let response = client.post("/")
/// .body("Hello, world!") /// .body("Hello, world!")
@ -70,7 +70,7 @@ impl Client {
where F: FnOnce(&Self, LocalRequest<'_>, LocalResponse<'_>) -> T + Send where F: FnOnce(&Self, LocalRequest<'_>, LocalResponse<'_>) -> T + Send
{ {
crate::async_test(async { crate::async_test(async {
let client = Client::debug(crate::ignite()).await.unwrap(); let client = Client::debug(crate::build()).await.unwrap();
let request = client.get("/"); let request = client.get("/");
let response = request.clone().dispatch().await; let response = request.clone().dispatch().await;
f(&client, request, response) f(&client, request, response)

View File

@ -21,7 +21,7 @@ use super::{Client, LocalResponse};
/// use rocket::http::{ContentType, Cookie}; /// use rocket::http::{ContentType, Cookie};
/// ///
/// # rocket::async_test(async { /// # rocket::async_test(async {
/// let client = Client::tracked(rocket::ignite()).await.expect("valid rocket"); /// let client = Client::tracked(rocket::build()).await.expect("valid rocket");
/// let req = client.post("/") /// let req = client.post("/")
/// .header(ContentType::JSON) /// .header(ContentType::JSON)
/// .remote("127.0.0.1:8000".parse().unwrap()) /// .remote("127.0.0.1:8000".parse().unwrap())

View File

@ -29,7 +29,7 @@ use crate::{Request, Response};
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite().mount("/", routes![hello_world]) /// rocket::build().mount("/", routes![hello_world])
/// # .reconfigure(rocket::Config::debug_default()) /// # .reconfigure(rocket::Config::debug_default())
/// } /// }
/// ///

View File

@ -20,7 +20,7 @@ use crate::http::{Method, uri::Origin};
/// ```rust,no_run /// ```rust,no_run
/// use rocket::local::blocking::Client; /// use rocket::local::blocking::Client;
/// ///
/// let rocket = rocket::ignite(); /// let rocket = rocket::build();
/// let client = Client::tracked(rocket).expect("valid rocket"); /// let client = Client::tracked(rocket).expect("valid rocket");
/// let response = client.post("/") /// let response = client.post("/")
/// .body("Hello, world!") /// .body("Hello, world!")
@ -50,7 +50,7 @@ impl Client {
pub fn _test<T, F>(f: F) -> T pub fn _test<T, F>(f: F) -> T
where F: FnOnce(&Self, LocalRequest<'_>, LocalResponse<'_>) -> T + Send where F: FnOnce(&Self, LocalRequest<'_>, LocalResponse<'_>) -> T + Send
{ {
let client = Client::debug(crate::ignite()).unwrap(); let client = Client::debug(crate::build()).unwrap();
let request = client.get("/"); let request = client.get("/");
let response = request.clone().dispatch(); let response = request.clone().dispatch();
f(&client, request, response) f(&client, request, response)

View File

@ -19,7 +19,7 @@ use super::{Client, LocalResponse};
/// use rocket::local::blocking::{Client, LocalRequest}; /// use rocket::local::blocking::{Client, LocalRequest};
/// use rocket::http::{ContentType, Cookie}; /// use rocket::http::{ContentType, Cookie};
/// ///
/// let client = Client::tracked(rocket::ignite()).expect("valid rocket"); /// let client = Client::tracked(rocket::build()).expect("valid rocket");
/// let req = client.post("/") /// let req = client.post("/")
/// .header(ContentType::JSON) /// .header(ContentType::JSON)
/// .remote("127.0.0.1:8000".parse().unwrap()) /// .remote("127.0.0.1:8000".parse().unwrap())

View File

@ -26,7 +26,7 @@ use super::Client;
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite().mount("/", routes![hello_world]) /// rocket::build().mount("/", routes![hello_world])
/// # .reconfigure(rocket::Config::debug_default()) /// # .reconfigure(rocket::Config::debug_default())
/// } /// }
/// ///

View File

@ -63,7 +63,7 @@ macro_rules! pub_client_impl {
/// ```rust,no_run /// ```rust,no_run
#[doc = $import] #[doc = $import]
/// ///
/// let rocket = rocket::ignite(); /// let rocket = rocket::build();
/// let client = Client::tracked(rocket); /// let client = Client::tracked(rocket);
/// ``` /// ```
#[inline(always)] #[inline(always)]
@ -88,7 +88,7 @@ macro_rules! pub_client_impl {
/// ```rust,no_run /// ```rust,no_run
#[doc = $import] #[doc = $import]
/// ///
/// let rocket = rocket::ignite(); /// let rocket = rocket::build();
/// let client = Client::untracked(rocket); /// let client = Client::untracked(rocket);
/// ``` /// ```
pub $($prefix)? fn untracked(rocket: Rocket) -> Result<Self, Error> { pub $($prefix)? fn untracked(rocket: Rocket) -> Result<Self, Error> {

View File

@ -45,7 +45,7 @@
//! #[launch] //! #[launch]
//! # */ //! # */
//! fn rocket() -> rocket::Rocket { //! fn rocket() -> rocket::Rocket {
//! rocket::ignite().mount("/", routes![hello]) //! rocket::build().mount("/", routes![hello])
//! } //! }
//! //!
//! #[cfg(test)] //! #[cfg(test)]

View File

@ -37,7 +37,7 @@ impl Rocket {
/// for more information on defaults. /// for more information on defaults.
/// ///
/// This method is typically called through the /// This method is typically called through the
/// [`rocket::ignite()`](crate::ignite) alias. /// [`rocket::build()`](crate::build) alias.
/// ///
/// # Panics /// # Panics
/// ///
@ -48,12 +48,12 @@ impl Rocket {
/// ///
/// ```rust /// ```rust
/// # { /// # {
/// rocket::ignite() /// rocket::build()
/// # }; /// # };
/// ``` /// ```
#[track_caller] #[track_caller]
#[inline(always)] #[inline(always)]
pub fn ignite() -> Rocket { pub fn build() -> Rocket {
Rocket::custom(Config::figment()) Rocket::custom(Config::figment())
} }
@ -178,7 +178,7 @@ impl Rocket {
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite().mount("/hello", routes![hi]) /// rocket::build().mount("/hello", routes![hi])
/// } /// }
/// ``` /// ```
/// ///
@ -196,7 +196,7 @@ impl Rocket {
/// } /// }
/// ///
/// # let _ = async { // We don't actually want to launch the server in an example. /// # let _ = async { // We don't actually want to launch the server in an example.
/// rocket::ignite().mount("/hello", vec![Route::new(Get, "/world", hi)]) /// rocket::build().mount("/hello", vec![Route::new(Get, "/world", hi)])
/// # .launch().await; /// # .launch().await;
/// # }; /// # };
/// ``` /// ```
@ -264,7 +264,7 @@ impl Rocket {
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite().register("/", catchers![internal_error, not_found]) /// rocket::build().register("/", catchers![internal_error, not_found])
/// } /// }
/// ``` /// ```
pub fn register<'a, B, C>(mut self, base: B, catchers: C) -> Self pub fn register<'a, B, C>(mut self, base: B, catchers: C) -> Self
@ -323,7 +323,7 @@ impl Rocket {
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite() /// rocket::build()
/// .mount("/", routes![index]) /// .mount("/", routes![index])
/// .manage(MyValue(10)) /// .manage(MyValue(10))
/// } /// }
@ -351,7 +351,7 @@ impl Rocket {
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite() /// rocket::build()
/// .attach(AdHoc::on_liftoff("Liftoff Message", |_| Box::pin(async { /// .attach(AdHoc::on_liftoff("Liftoff Message", |_| Box::pin(async {
/// println!("We have liftoff!"); /// println!("We have liftoff!");
/// }))) /// })))
@ -373,7 +373,7 @@ impl Rocket {
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite() /// rocket::build()
/// .attach(AdHoc::on_liftoff("Print Config", |rocket| Box::pin(async move { /// .attach(AdHoc::on_liftoff("Print Config", |rocket| Box::pin(async move {
/// println!("Rocket launch config: {:?}", rocket.config()); /// println!("Rocket launch config: {:?}", rocket.config());
/// }))) /// })))
@ -389,7 +389,7 @@ impl Rocket {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// let rocket = rocket::ignite(); /// let rocket = rocket::build();
/// let figment = rocket.figment(); /// let figment = rocket.figment();
/// ///
/// let port: u16 = figment.extract_inner("port").unwrap(); /// let port: u16 = figment.extract_inner("port").unwrap();
@ -416,7 +416,7 @@ impl Rocket {
/// } /// }
/// ///
/// fn main() { /// fn main() {
/// let mut rocket = rocket::ignite() /// let mut rocket = rocket::build()
/// .mount("/", routes![hello]) /// .mount("/", routes![hello])
/// .mount("/hi", routes![hello]); /// .mount("/hi", routes![hello]);
/// ///
@ -451,7 +451,7 @@ impl Rocket {
/// #[catch(default)] fn some_default() -> &'static str { "Everything else." } /// #[catch(default)] fn some_default() -> &'static str { "Everything else." }
/// ///
/// fn main() { /// fn main() {
/// let mut rocket = rocket::ignite() /// let mut rocket = rocket::build()
/// .register("/", catchers![not_found, just_500, some_default]); /// .register("/", catchers![not_found, just_500, some_default]);
/// ///
/// let mut codes: Vec<_> = rocket.catchers().map(|c| c.code).collect(); /// let mut codes: Vec<_> = rocket.catchers().map(|c| c.code).collect();
@ -474,7 +474,7 @@ impl Rocket {
/// #[derive(PartialEq, Debug)] /// #[derive(PartialEq, Debug)]
/// struct MyState(&'static str); /// struct MyState(&'static str);
/// ///
/// let rocket = rocket::ignite().manage(MyState("hello!")); /// let rocket = rocket::build().manage(MyState("hello!"));
/// assert_eq!(rocket.state::<MyState>(), Some(&MyState("hello!"))); /// assert_eq!(rocket.state::<MyState>(), Some(&MyState("hello!")));
/// ``` /// ```
#[inline(always)] #[inline(always)]
@ -490,7 +490,7 @@ impl Rocket {
/// ```rust,no_run /// ```rust,no_run
/// # use std::{thread, time::Duration}; /// # use std::{thread, time::Duration};
/// # rocket::async_test(async { /// # rocket::async_test(async {
/// let mut rocket = rocket::ignite(); /// let mut rocket = rocket::build();
/// let handle = rocket.shutdown(); /// let handle = rocket.shutdown();
/// ///
/// thread::spawn(move || { /// thread::spawn(move || {
@ -571,7 +571,7 @@ impl Rocket {
/// #[rocket::main] /// #[rocket::main]
/// async fn main() { /// async fn main() {
/// # if false { /// # if false {
/// let result = rocket::ignite().launch().await; /// let result = rocket::build().launch().await;
/// assert!(result.is_ok()); /// assert!(result.is_ok());
/// # } /// # }
/// } /// }

View File

@ -26,7 +26,7 @@ use crate::router::segment::Segment;
/// let route = Route::new(Method::Get, "/foo/<bar>", handler); /// let route = Route::new(Method::Get, "/foo/<bar>", handler);
/// assert_eq!(route.uri.base(), "/"); /// assert_eq!(route.uri.base(), "/");
/// ///
/// let rocket = rocket::ignite().mount("/base", vec![route]); /// let rocket = rocket::build().mount("/base", vec![route]);
/// let routes: Vec<_> = rocket.routes().collect(); /// let routes: Vec<_> = rocket.routes().collect();
/// assert_eq!(routes[0].uri.base(), "/base"); /// assert_eq!(routes[0].uri.base(), "/base");
/// ``` /// ```
@ -46,7 +46,7 @@ use crate::router::segment::Segment;
/// let route = Route::new(Method::Get, "/foo/<bar>", handler); /// let route = Route::new(Method::Get, "/foo/<bar>", handler);
/// assert_eq!(route.uri, "/foo/<bar>"); /// assert_eq!(route.uri, "/foo/<bar>");
/// ///
/// let rocket = rocket::ignite().mount("/base", vec![route]); /// let rocket = rocket::build().mount("/base", vec![route]);
/// let routes: Vec<_> = rocket.routes().collect(); /// let routes: Vec<_> = rocket.routes().collect();
/// assert_eq!(routes[0].uri, "/base/foo/<bar>"); /// assert_eq!(routes[0].uri, "/base/foo/<bar>");
/// ``` /// ```

View File

@ -24,7 +24,7 @@ use tokio::sync::mpsc;
/// ///
/// #[rocket::main] /// #[rocket::main]
/// async fn main() { /// async fn main() {
/// let result = rocket::ignite() /// let result = rocket::build()
/// .mount("/", routes![shutdown]) /// .mount("/", routes![shutdown])
/// .launch() /// .launch()
/// .await; /// .await;

View File

@ -44,7 +44,7 @@ use crate::http::Status;
/// ///
/// #[launch] /// #[launch]
/// fn rocket() -> rocket::Rocket { /// fn rocket() -> rocket::Rocket {
/// rocket::ignite() /// rocket::build()
/// .mount("/", routes![index, raw_config_value]) /// .mount("/", routes![index, raw_config_value])
/// .manage(MyConfig { user_val: "user input".to_string() }) /// .manage(MyConfig { user_val: "user input".to_string() })
/// } /// }
@ -101,7 +101,7 @@ use crate::http::Status;
/// state.0.to_string() /// state.0.to_string()
/// } /// }
/// ///
/// let mut rocket = rocket::ignite().manage(MyManagedState(127)); /// let mut rocket = rocket::build().manage(MyManagedState(127));
/// let state = State::from(&rocket).expect("managed `MyManagedState`"); /// let state = State::from(&rocket).expect("managed `MyManagedState`");
/// assert_eq!(handler(state), "127"); /// assert_eq!(handler(state), "127");
/// ``` /// ```
@ -154,7 +154,7 @@ impl<'r, T: Send + Sync + 'static> State<'r, T> {
/// #[derive(Debug, PartialEq)] /// #[derive(Debug, PartialEq)]
/// struct Unmanaged(usize); /// struct Unmanaged(usize);
/// ///
/// let rocket = rocket::ignite().manage(Managed(7)); /// let rocket = rocket::build().manage(Managed(7));
/// ///
/// let state: Option<State<Managed>> = State::from(&rocket); /// let state: Option<State<Managed>> = State::from(&rocket);
/// assert_eq!(state.map(|s| s.inner()), Some(&Managed(7))); /// assert_eq!(state.map(|s| s.inner()), Some(&Managed(7)));

View File

@ -22,7 +22,7 @@ mod tests {
#[test] #[test]
fn error_catcher_sets_cookies() { fn error_catcher_sets_cookies() {
let rocket = rocket::ignite() let rocket = rocket::build()
.mount("/", routes![index]) .mount("/", routes![index])
.register("/", catchers![not_found]) .register("/", catchers![not_found])
.attach(AdHoc::on_request("Add Cookie", |req, _| Box::pin(async move { .attach(AdHoc::on_request("Add Cookie", |req, _| Box::pin(async move {

View File

@ -26,7 +26,7 @@ mod fairing_before_head_strip {
#[test] #[test]
fn not_auto_handled() { fn not_auto_handled() {
let rocket = rocket::ignite() let rocket = rocket::build()
.mount("/", routes![head]) .mount("/", routes![head])
.attach(AdHoc::on_request("Check HEAD", |req, _| { .attach(AdHoc::on_request("Check HEAD", |req, _| {
Box::pin(async move { Box::pin(async move {
@ -52,7 +52,7 @@ mod fairing_before_head_strip {
struct Counter(AtomicUsize); struct Counter(AtomicUsize);
let counter = Counter::default(); let counter = Counter::default();
let rocket = rocket::ignite() let rocket = rocket::build()
.mount("/", routes![auto]) .mount("/", routes![auto])
.manage(counter) .manage(counter)
.attach(AdHoc::on_request("Check HEAD + Count", |req, _| { .attach(AdHoc::on_request("Check HEAD + Count", |req, _| {

View File

@ -10,5 +10,5 @@ impl Drop for SpawnBlockingOnDrop {
#[test] #[test]
fn test_access_runtime_in_state_drop() { fn test_access_runtime_in_state_drop() {
Client::debug(rocket::ignite().manage(SpawnBlockingOnDrop)).unwrap(); Client::debug(rocket::build().manage(SpawnBlockingOnDrop)).unwrap();
} }

View File

@ -49,7 +49,7 @@ mod local_request_content_type_tests {
use rocket::http::ContentType; use rocket::http::ContentType;
fn rocket() -> Rocket { fn rocket() -> Rocket {
rocket::ignite().mount("/", routes![rg_ct, data_has_ct, data_no_ct]) rocket::build().mount("/", routes![rg_ct, data_has_ct, data_no_ct])
} }
#[test] #[test]

View File

@ -18,7 +18,7 @@ mod tests {
#[test] #[test]
fn private_cookie_is_returned() { fn private_cookie_is_returned() {
let rocket = rocket::ignite().mount("/", routes![return_private_cookie]); let rocket = rocket::build().mount("/", routes![return_private_cookie]);
let client = Client::debug(rocket).unwrap(); let client = Client::debug(rocket).unwrap();
let req = client.get("/").private_cookie(Cookie::new("cookie_name", "cookie_value")); let req = client.get("/").private_cookie(Cookie::new("cookie_name", "cookie_value"));
@ -30,7 +30,7 @@ mod tests {
#[test] #[test]
fn regular_cookie_is_not_returned() { fn regular_cookie_is_not_returned() {
let rocket = rocket::ignite().mount("/", routes![return_private_cookie]); let rocket = rocket::build().mount("/", routes![return_private_cookie]);
let client = Client::debug(rocket).unwrap(); let client = Client::debug(rocket).unwrap();
let req = client.get("/").cookie(Cookie::new("cookie_name", "cookie_value")); let req = client.get("/").cookie(Cookie::new("cookie_name", "cookie_value"));

View File

@ -23,7 +23,7 @@ mod many_cookie_jars_tests {
use rocket::local::blocking::Client; use rocket::local::blocking::Client;
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", routes![multi_add, multi_get]) rocket::build().mount("/", routes![multi_add, multi_get])
} }
#[test] #[test]

View File

@ -21,7 +21,7 @@ mod a {
} }
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", a::routes()).mount("/foo", a::routes()) rocket::build().mount("/", a::routes()).mount("/foo", a::routes())
} }
mod mapped_base_tests { mod mapped_base_tests {

View File

@ -1,10 +1,10 @@
#[test] #[test]
#[should_panic] #[should_panic]
fn bad_dynamic_mount() { fn bad_dynamic_mount() {
rocket::ignite().mount("<name>", vec![]); rocket::build().mount("<name>", vec![]);
} }
#[test] #[test]
fn good_static_mount() { fn good_static_mount() {
rocket::ignite().mount("/abcdefghijkl_mno", vec![]); rocket::build().mount("/abcdefghijkl_mno", vec![]);
} }

View File

@ -20,7 +20,7 @@ fn index(counter: State<'_, Counter>) -> String {
} }
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite() rocket::build()
.mount("/", routes![index]) .mount("/", routes![index])
.attach(AdHoc::on_launch("Outer", |rocket| async { .attach(AdHoc::on_launch("Outer", |rocket| async {
let counter = Counter::default(); let counter = Counter::default();

View File

@ -27,7 +27,7 @@ fn pre_future_route<'r>(_: &'r Request<'_>, _: Data) -> HandlerFuture<'r> {
} }
fn rocket() -> Rocket { fn rocket() -> Rocket {
rocket::ignite() rocket::build()
.mount("/", routes![panic_route]) .mount("/", routes![panic_route])
.mount("/", vec![Route::new(Method::Get, "/pre", pre_future_route)]) .mount("/", vec![Route::new(Method::Get, "/pre", pre_future_route)])
} }

View File

@ -28,7 +28,7 @@ mod tests {
use rocket::http::{Status, ContentType}; use rocket::http::{Status, ContentType};
fn rocket() -> Rocket { fn rocket() -> Rocket {
rocket::ignite() rocket::build()
.mount("/first", routes![specified, unspecified]) .mount("/first", routes![specified, unspecified])
.mount("/second", routes![specified_json, specified_html]) .mount("/second", routes![specified_json, specified_html])
} }

View File

@ -14,7 +14,7 @@ mod tests {
#[test] #[test]
fn error_catcher_redirect() { fn error_catcher_redirect() {
let client = Client::debug(rocket::ignite().register("/", catchers![not_found])).unwrap(); let client = Client::debug(rocket::build().register("/", catchers![not_found])).unwrap();
let response = client.get("/unknown").dispatch(); let response = client.get("/unknown").dispatch();
let location: Vec<_> = response.headers().get("location").collect(); let location: Vec<_> = response.headers().get("location").collect();

View File

@ -7,7 +7,7 @@ fn index(_data: rocket::Data) -> &'static str { "json" }
fn other_index(_data: rocket::Data) -> &'static str { "other" } fn other_index(_data: rocket::Data) -> &'static str { "other" }
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite() rocket::build()
.mount("/", rocket::routes![index, other_index]) .mount("/", rocket::routes![index, other_index])
.attach(AdHoc::on_request("Change CT", |req, _| Box::pin(async move { .attach(AdHoc::on_request("Change CT", |req, _| Box::pin(async move {
let need_ct = req.content_type().is_none(); let need_ct = req.content_type().is_none();

View File

@ -20,7 +20,7 @@ mod route_guard_tests {
#[test] #[test]
fn check_mount_path() { fn check_mount_path() {
let rocket = rocket::ignite() let rocket = rocket::build()
.mount("/first", routes![files]) .mount("/first", routes![files])
.mount("/second", routes![files]); .mount("/second", routes![files]);

View File

@ -16,7 +16,7 @@ fn hello_name(name: String) -> String {
} }
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite() rocket::build()
.mount("/", routes![hello_name]) .mount("/", routes![hello_name])
.mount("/", rocket::routes![inner::hello]) .mount("/", rocket::routes![inner::hello])
} }

View File

@ -33,7 +33,7 @@ mod tests {
#[test] #[test]
fn segments_works() { fn segments_works() {
let rocket = rocket::ignite() let rocket = rocket::build()
.mount("/", routes![test, two, one_two, none, dual]) .mount("/", routes![test, two, one_two, none, dual])
.mount("/point", routes![test, two, one_two, dual]); .mount("/point", routes![test, two, one_two, dual]);
let client = Client::debug(rocket).unwrap(); let client = Client::debug(rocket).unwrap();

View File

@ -14,7 +14,7 @@ mod test_session_cookies {
#[test] #[test]
fn session_cookie_is_session() { fn session_cookie_is_session() {
let rocket = rocket::ignite().mount("/", rocket::routes![index]); let rocket = rocket::build().mount("/", rocket::routes![index]);
let client = Client::debug(rocket).unwrap(); let client = Client::debug(rocket).unwrap();
let response = client.get("/").dispatch(); let response = client.get("/").dispatch();

View File

@ -7,7 +7,7 @@ async fn test_await_timer_inside_attach() {
rocket::tokio::time::sleep(std::time::Duration::from_millis(100)).await; rocket::tokio::time::sleep(std::time::Duration::from_millis(100)).await;
} }
rocket::ignite() rocket::build()
.attach(rocket::fairing::AdHoc::on_launch("1", |rocket| async { .attach(rocket::fairing::AdHoc::on_launch("1", |rocket| async {
do_async_setup().await; do_async_setup().await;
rocket rocket

View File

@ -3,5 +3,5 @@ struct A;
#[test] #[test]
#[should_panic] #[should_panic]
fn twice_managed_state() { fn twice_managed_state() {
let _ = rocket::ignite().manage(A).manage(A); let _ = rocket::build().manage(A).manage(A);
} }

View File

@ -21,7 +21,7 @@ fn uri_redirect() -> Redirect {
} }
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", routes![hello, uri_redirect, raw_redirect]) rocket::build().mount("/", routes![hello, uri_redirect, raw_redirect])
} }

View File

@ -23,7 +23,7 @@ fn read_config(rocket_config: &Config, app_config: State<'_, AppConfig>) -> Stri
// and automatically by compiling with `--release`. // and automatically by compiling with `--release`.
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.mount("/", routes![read_config]) .mount("/", routes![read_config])
.attach(AdHoc::config::<AppConfig>()) .attach(AdHoc::config::<AppConfig>())
} }

View File

@ -15,7 +15,7 @@ fn index() -> Html<&'static str> {
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.attach(Template::fairing()) .attach(Template::fairing())
.mount("/", routes![index]) .mount("/", routes![index])
.mount("/message", message::routes()) .mount("/message", message::routes())

View File

@ -11,7 +11,7 @@ mod rusqlite;
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.attach(sqlx::stage()) .attach(sqlx::stage())
.attach(rusqlite::stage()) .attach(rusqlite::stage())
.attach(diesel_sqlite::stage()) .attach(diesel_sqlite::stage())

View File

@ -37,7 +37,7 @@ fn test(base: &str, stage: AdHoc) {
// NOTE: If we had more than one test running concurently that dispatches // NOTE: If we had more than one test running concurently that dispatches
// DB-accessing requests, we'd need transactions or to serialize all tests. // DB-accessing requests, we'd need transactions or to serialize all tests.
let client = Client::tracked(rocket::ignite().attach(stage)).unwrap(); let client = Client::tracked(rocket::build().attach(stage)).unwrap();
// Clear everything from the database. // Clear everything from the database.
assert_eq!(client.delete(base).dispatch().status(), Status::Ok); assert_eq!(client.delete(base).dispatch().status(), Status::Ok);

View File

@ -44,7 +44,7 @@ fn default_catcher(status: Status, req: &Request<'_>) -> status::Custom<String>
} }
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite() rocket::build()
// .mount("/", routes![hello, hello]) // uncoment this to get an error // .mount("/", routes![hello, hello]) // uncoment this to get an error
.mount("/", routes![hello, forced_error]) .mount("/", routes![hello, forced_error])
.register("/", catchers![general_not_found, default_catcher]) .register("/", catchers![general_not_found, default_catcher])

View File

@ -59,7 +59,7 @@ fn token(token: State<'_, Token>) -> String {
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.mount("/", routes![hello, token]) .mount("/", routes![hello, token])
.attach(Counter::default()) .attach(Counter::default())
.attach(AdHoc::try_on_launch("Token State", |rocket| async { .attach(AdHoc::try_on_launch("Token State", |rocket| async {

View File

@ -82,7 +82,7 @@ fn submit<'r>(form: Form<Contextual<'r, Submit<'r>>>) -> (Status, Template) {
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.mount("/", routes![index, submit]) .mount("/", routes![index, submit])
.attach(Template::fairing()) .attach(Template::fairing())
.mount("/", StaticFiles::from(crate_relative!("/static"))) .mount("/", StaticFiles::from(crate_relative!("/static")))

View File

@ -57,7 +57,7 @@ fn hello(lang: Option<Lang>, opt: Options<'_>) -> String {
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.mount("/", routes![hello]) .mount("/", routes![hello])
.mount("/hello", routes![world, mir]) .mount("/hello", routes![world, mir])
.mount("/wave", routes![wave]) .mount("/wave", routes![wave])

View File

@ -104,7 +104,7 @@ fn rocket() -> _ {
let not_found_catcher = Catcher::new(404, not_found_handler); let not_found_catcher = Catcher::new(404, not_found_handler);
rocket::ignite() rocket::build()
.mount("/", vec![always_forward, hello, echo]) .mount("/", vec![always_forward, hello, echo])
.mount("/upload", vec![get_upload, post_upload]) .mount("/upload", vec![get_upload, post_upload])
.mount("/hello", vec![name.clone()]) .mount("/hello", vec![name.clone()])

View File

@ -56,7 +56,7 @@ fn index() -> &'static str {
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.manage(Absolute::parse(HOST).expect("valid host")) .manage(Absolute::parse(HOST).expect("valid host"))
.mount("/", routes![index, upload, delete, retrieve]) .mount("/", routes![index, upload, delete, retrieve])
} }

View File

@ -153,7 +153,7 @@ async fn custom(kind: Option<Kind>) -> StoredData {
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.mount("/", routes![many_as, file, upload, delete]) .mount("/", routes![many_as, file, upload, delete])
.mount("/", routes![redir_root, redir_login, maybe_redir]) .mount("/", routes![redir_root, redir_login, maybe_redir])
.mount("/", routes![xml, json, json_or_msgpack]) .mount("/", routes![xml, json, json_or_msgpack])

View File

@ -7,7 +7,7 @@ mod msgpack;
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.attach(json::stage()) .attach(json::stage())
.attach(msgpack::stage()) .attach(msgpack::stage())
} }

View File

@ -8,7 +8,7 @@ mod managed_queue;
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.attach(request_local::stage()) .attach(request_local::stage())
.attach(managed_hit_count::stage()) .attach(managed_hit_count::stage())
.attach(managed_queue::stage()) .attach(managed_queue::stage())

View File

@ -21,7 +21,7 @@ mod manual {
#[rocket::launch] #[rocket::launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.mount("/", rocket::routes![manual::second]) .mount("/", rocket::routes![manual::second])
.mount("/", StaticFiles::from(crate_relative!("static"))) .mount("/", StaticFiles::from(crate_relative!("static")))
} }

View File

@ -15,7 +15,7 @@ fn index() -> Html<&'static str> {
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.mount("/", routes![index]) .mount("/", routes![index])
.mount("/tera", routes![tera::index, tera::hello]) .mount("/tera", routes![tera::index, tera::hello])
.mount("/hbs", routes![hbs::index, hbs::hello, hbs::about]) .mount("/hbs", routes![hbs::index, hbs::hello, hbs::about])

View File

@ -10,7 +10,7 @@ async fn rendezvous(barrier: State<'_, Barrier>) -> &'static str {
} }
pub fn rocket() -> rocket::Rocket { pub fn rocket() -> rocket::Rocket {
rocket::ignite() rocket::build()
.mount("/", routes![rendezvous]) .mount("/", routes![rendezvous])
.attach(AdHoc::on_launch("Add Channel", |rocket| async { .attach(AdHoc::on_launch("Add Channel", |rocket| async {
rocket.manage(Barrier::new(2)) rocket.manage(Barrier::new(2))

View File

@ -10,5 +10,5 @@ fn hello() -> &'static str {
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
// See `Rocket.toml` and `Cargo.toml` for TLS configuration. // See `Rocket.toml` and `Cargo.toml` for TLS configuration.
rocket::ignite().mount("/", routes![hello]) rocket::build().mount("/", routes![hello])
} }

View File

@ -104,7 +104,7 @@ async fn run_migrations(rocket: Rocket) -> Rocket {
#[launch] #[launch]
fn rocket() -> Rocket { fn rocket() -> Rocket {
rocket::ignite() rocket::build()
.attach(DbConn::fairing()) .attach(DbConn::fairing())
.attach(Template::fairing()) .attach(Template::fairing())
.attach(AdHoc::on_launch("Run Migrations", run_migrations)) .attach(AdHoc::on_launch("Run Migrations", run_migrations))

View File

@ -30,7 +30,7 @@ fn rocket() -> _ {
map.insert("4da34121-bc7d-4fc1-aee6-bf8de0795333".parse().unwrap(), "Bob"); map.insert("4da34121-bc7d-4fc1-aee6-bf8de0795333".parse().unwrap(), "Bob");
map.insert("ad962969-4e3d-4de7-ac4a-2d86d6d10839".parse().unwrap(), "George"); map.insert("ad962969-4e3d-4de7-ac4a-2d86d6d10839".parse().unwrap(), "George");
rocket::ignite() rocket::build()
.manage(People(map)) .manage(People(map))
.mount("/", routes![people]) .mount("/", routes![people])
} }

View File

@ -54,7 +54,7 @@ And finally, create a skeleton Rocket application to work off of in
#[launch] #[launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite() rocket::build()
} }
``` ```
@ -111,7 +111,7 @@ to them. To mount the `index` route, modify the main function so that it reads:
#[launch] #[launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", routes![index]) rocket::build().mount("/", routes![index])
} }
``` ```
@ -277,7 +277,7 @@ extension trait. Ensure that the route is mounted at the root path:
#[launch] #[launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", routes![index, upload]) rocket::build().mount("/", routes![index, upload])
} }
``` ```
@ -341,7 +341,7 @@ Make sure that the route is mounted at the root path:
#[launch] #[launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", routes![index, upload, retrieve]) rocket::build().mount("/", routes![index, upload, retrieve])
} }
``` ```

View File

@ -72,7 +72,7 @@ fn index() -> &'static str {
#[launch] #[launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", routes![index]) rocket::build().mount("/", routes![index])
} }
``` ```

View File

@ -101,7 +101,7 @@ Before Rocket can dispatch requests to a route, the route needs to be _mounted_:
# "hello, world!" # "hello, world!"
# } # }
rocket::ignite().mount("/hello", routes![world]); rocket::build().mount("/hello", routes![world]);
``` ```
The `mount` method takes as input: The `mount` method takes as input:
@ -110,7 +110,7 @@ The `mount` method takes as input:
2. A list of routes via the `routes!` macro: here, `routes![world]`, with 2. A list of routes via the `routes!` macro: here, `routes![world]`, with
multiple routes: `routes![a, b, c]`. multiple routes: `routes![a, b, c]`.
This creates a new `Rocket` instance via the `ignite` function and mounts the This creates a new `Rocket` instance via the `build` function and mounts the
`world` route to the `/hello` base path, making Rocket aware of the route. `world` route to the `/hello` base path, making Rocket aware of the route.
`GET` requests to `/hello/world` will be directed to the `world` function. `GET` requests to `/hello/world` will be directed to the `world` function.
@ -125,7 +125,7 @@ any number of times, and routes can be reused by mount points:
# "hello, world!" # "hello, world!"
# } # }
rocket::ignite() rocket::build()
.mount("/hello", routes![world]) .mount("/hello", routes![world])
.mount("/hi", routes![world]); .mount("/hi", routes![world]);
``` ```
@ -156,7 +156,7 @@ fn world() -> &'static str {
#[launch] #[launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/hello", routes![world]) rocket::build().mount("/hello", routes![world])
} }
``` ```
@ -212,7 +212,7 @@ runtime but unlike `#[launch]`, allows _you_ to start the server:
#[rocket::main] #[rocket::main]
async fn main() { async fn main() {
rocket::ignite() rocket::build()
.mount("/hello", routes![world]) .mount("/hello", routes![world])
.launch() .launch()
.await; .await;

View File

@ -201,7 +201,7 @@ fn user_str(id: &str) { /* ... */ }
#[launch] #[launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", routes![user, user_int, user_str]) rocket::build().mount("/", routes![user, user_int, user_str])
} }
``` ```
@ -1771,7 +1771,7 @@ looks like:
# #[catch(404)] fn not_found(req: &Request) { /* .. */ } # #[catch(404)] fn not_found(req: &Request) { /* .. */ }
fn main() { fn main() {
rocket::ignite().register("/", catchers![not_found]); rocket::build().register("/", catchers![not_found]);
} }
``` ```
@ -1800,7 +1800,7 @@ fn foo_not_found() -> &'static str {
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.register("/", catchers![general_not_found]) .register("/", catchers![general_not_found])
.register("/foo", catchers![foo_not_found]) .register("/foo", catchers![foo_not_found])
} }
@ -1846,7 +1846,7 @@ fn default_catcher(status: Status, request: &Request) { /* .. */ }
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite().register("/", catchers![default_catcher]) rocket::build().register("/", catchers![default_catcher])
} }
``` ```

View File

@ -395,7 +395,7 @@ fairings. To attach the template fairing, simply call
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.mount("/", routes![/* .. */]) .mount("/", routes![/* .. */])
.attach(Template::fairing()) .attach(Template::fairing())
} }

View File

@ -42,7 +42,7 @@ struct HitCount {
count: AtomicUsize count: AtomicUsize
} }
rocket::ignite().manage(HitCount { count: AtomicUsize::new(0) }); rocket::build().manage(HitCount { count: AtomicUsize::new(0) });
``` ```
The `manage` method can be called any number of times as long as each call The `manage` method can be called any number of times as long as each call
@ -55,7 +55,7 @@ a `HitCount` value and a `Config` value, we can write:
# type Config = &'static str; # type Config = &'static str;
# let user_input = "input"; # let user_input = "input";
rocket::ignite() rocket::build()
.manage(HitCount { count: AtomicUsize::new(0) }) .manage(HitCount { count: AtomicUsize::new(0) })
.manage(Config::from(user_input)); .manage(Config::from(user_input));
``` ```
@ -292,7 +292,7 @@ struct LogsDbConn(diesel::SqliteConnection);
#[launch] #[launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().attach(LogsDbConn::fairing()) rocket::build().attach(LogsDbConn::fairing())
} }
``` ```

View File

@ -55,7 +55,7 @@ fn rocket() -> rocket::Rocket {
# let req_fairing = rocket::fairing::AdHoc::on_request("example", |_, _| Box::pin(async {})); # let req_fairing = rocket::fairing::AdHoc::on_request("example", |_, _| Box::pin(async {}));
# let res_fairing = rocket::fairing::AdHoc::on_response("example", |_, _| Box::pin(async {})); # let res_fairing = rocket::fairing::AdHoc::on_response("example", |_, _| Box::pin(async {}));
rocket::ignite() rocket::build()
.attach(req_fairing) .attach(req_fairing)
.attach(res_fairing) .attach(res_fairing)
} }
@ -217,7 +217,7 @@ prints a message indicating that the application has launched. The second named
use rocket::fairing::AdHoc; use rocket::fairing::AdHoc;
use rocket::http::Method; use rocket::http::Method;
rocket::ignite() rocket::build()
.attach(AdHoc::on_liftoff("Liftoff Printer", |_| Box::pin(async move { .attach(AdHoc::on_liftoff("Liftoff Printer", |_| Box::pin(async move {
println!("...annnddd we have liftoff!"); println!("...annnddd we have liftoff!");
}))) })))

View File

@ -15,7 +15,7 @@ instance. Usage is straightforward:
1. Construct a `Rocket` instance that represents the application. 1. Construct a `Rocket` instance that represents the application.
```rust,no_run ```rust,no_run
let rocket = rocket::ignite(); let rocket = rocket::build();
# let _ = rocket; # let _ = rocket;
``` ```
@ -23,7 +23,7 @@ instance. Usage is straightforward:
```rust,no_run ```rust,no_run
# use rocket::local::blocking::Client; # use rocket::local::blocking::Client;
# let rocket = rocket::ignite(); # let rocket = rocket::build();
let client = Client::tracked(rocket).unwrap(); let client = Client::tracked(rocket).unwrap();
# let _ = client; # let _ = client;
``` ```
@ -32,7 +32,7 @@ instance. Usage is straightforward:
```rust,no_run ```rust,no_run
# use rocket::local::blocking::Client; # use rocket::local::blocking::Client;
# let rocket = rocket::ignite(); # let rocket = rocket::build();
# let client = Client::tracked(rocket).unwrap(); # let client = Client::tracked(rocket).unwrap();
let req = client.get("/"); let req = client.get("/");
# let _ = req; # let _ = req;
@ -42,7 +42,7 @@ instance. Usage is straightforward:
```rust,no_run ```rust,no_run
# use rocket::local::blocking::Client; # use rocket::local::blocking::Client;
# let rocket = rocket::ignite(); # let rocket = rocket::build();
# let client = Client::tracked(rocket).unwrap(); # let client = Client::tracked(rocket).unwrap();
# let req = client.get("/"); # let req = client.get("/");
let response = req.dispatch(); let response = req.dispatch();
@ -99,7 +99,7 @@ These methods are typically used in combination with the `assert_eq!` or
# use rocket::local::blocking::Client; # use rocket::local::blocking::Client;
use rocket::http::{ContentType, Status}; use rocket::http::{ContentType, Status};
# let rocket = rocket::ignite().mount("/", routes![hello]); # let rocket = rocket::build().mount("/", routes![hello]);
# let client = Client::debug(rocket).expect("valid rocket instance"); # let client = Client::debug(rocket).expect("valid rocket instance");
let mut response = client.get("/").dispatch(); let mut response = client.get("/").dispatch();
@ -124,7 +124,7 @@ fn hello() -> &'static str {
#[launch] #[launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", routes![hello]) rocket::build().mount("/", routes![hello])
} }
``` ```
@ -165,7 +165,7 @@ testing: we _want_ our tests to panic when something goes wrong.
```rust ```rust
# fn rocket() -> rocket::Rocket { # fn rocket() -> rocket::Rocket {
# rocket::ignite().reconfigure(rocket::Config::debug_default()) # rocket::build().reconfigure(rocket::Config::debug_default())
# } # }
# use rocket::local::blocking::Client; # use rocket::local::blocking::Client;
@ -177,7 +177,7 @@ application's response:
```rust ```rust
# fn rocket() -> rocket::Rocket { # fn rocket() -> rocket::Rocket {
# rocket::ignite().reconfigure(rocket::Config::debug_default()) # rocket::build().reconfigure(rocket::Config::debug_default())
# } # }
# use rocket::local::blocking::Client; # use rocket::local::blocking::Client;
# let client = Client::tracked(rocket()).expect("valid rocket instance"); # let client = Client::tracked(rocket()).expect("valid rocket instance");
@ -201,7 +201,7 @@ We do this by checking the `Response` object directly:
# use rocket::local::blocking::Client; # use rocket::local::blocking::Client;
use rocket::http::{ContentType, Status}; use rocket::http::{ContentType, Status};
# #
# let rocket = rocket::ignite().mount("/", routes![hello]); # let rocket = rocket::build().mount("/", routes![hello]);
# let client = Client::debug(rocket).expect("valid rocket instance"); # let client = Client::debug(rocket).expect("valid rocket instance");
# let mut response = client.get("/").dispatch(); # let mut response = client.get("/").dispatch();
@ -220,7 +220,7 @@ fn hello() -> &'static str {
} }
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", routes![hello]) rocket::build().mount("/", routes![hello])
} }
# /* # /*

View File

@ -124,7 +124,7 @@ values are ignored.
## Default Provider ## Default Provider
Rocket's default configuration provider is [`Config::figment()`]; this is the Rocket's default configuration provider is [`Config::figment()`]; this is the
provider that's used when calling [`rocket::ignite()`]. provider that's used when calling [`rocket::build()`].
The default figment merges, at a per-key level, and reads from the following The default figment merges, at a per-key level, and reads from the following
sources, in ascending priority order: sources, in ascending priority order:
@ -212,7 +212,7 @@ use serde::Deserialize;
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
let rocket = rocket::ignite(); let rocket = rocket::build();
let figment = rocket.figment(); let figment = rocket.figment();
#[derive(Deserialize)] #[derive(Deserialize)]
@ -259,7 +259,7 @@ fn custom(config: State<'_, Config>) -> String {
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
rocket::ignite() rocket::build()
.mount("/", routes![custom]) .mount("/", routes![custom])
.attach(AdHoc::config::<Config>()) .attach(AdHoc::config::<Config>())
} }
@ -270,7 +270,7 @@ fn rocket() -> _ {
## Custom Providers ## Custom Providers
A custom provider can be set via [`rocket::custom()`], which replaces calls to A custom provider can be set via [`rocket::custom()`], which replaces calls to
[`rocket::ignite()`]. The configured provider can be built on top of [`rocket::build()`]. The configured provider can be built on top of
[`Config::figment()`], [`Config::default()`], both, or neither. The [`Config::figment()`], [`Config::default()`], both, or neither. The
[Figment](@figment) documentation has full details on instantiating existing [Figment](@figment) documentation has full details on instantiating existing
providers like [`Toml`] and [`Json`] as well as creating custom providers for providers like [`Toml`] and [`Json`] as well as creating custom providers for
@ -356,4 +356,4 @@ or `APP_` environment variables, Rocket will make use of them. The application
can also extract its configuration, done here via the `Adhoc::config()` fairing. can also extract its configuration, done here via the `Adhoc::config()` fairing.
[`rocket::custom()`]: @api/rocket/fn.custom.html [`rocket::custom()`]: @api/rocket/fn.custom.html
[`rocket::ignite()`]: @api/rocket/fn.custom.html [`rocket::build()`]: @api/rocket/fn.custom.html

View File

@ -56,7 +56,7 @@ code = '''
#[launch] #[launch]
fn rocket() -> rocket::Rocket { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", routes![hello]) rocket::build().mount("/", routes![hello])
} }
''' '''
text = ''' text = '''

View File

@ -143,7 +143,7 @@ function, look like:
```rust ```rust
#[launch] #[launch]
fn rocket() -> Rocket { fn rocket() -> Rocket {
rocket::ignite().mount("/base", routes![index, another]) rocket::build().mount("/base", routes![index, another])
} }
``` ```