diff --git a/contrib/codegen/src/database.rs b/contrib/codegen/src/database.rs index efd23441..2fea4263 100644 --- a/contrib/codegen/src/database.rs +++ b/contrib/codegen/src/database.rs @@ -118,8 +118,8 @@ pub fn database_attr(attr: TokenStream, input: TokenStream) -> Result Option { - manifest.state::<#pool_type>() + pub fn get_one(cargo: &::rocket::Cargo) -> Option { + cargo.state::<#pool_type>() .and_then(|pool| pool.0.get().ok()) .map(#guard_type) } diff --git a/contrib/lib/src/databases.rs b/contrib/lib/src/databases.rs index 2251a8ec..37a8a254 100644 --- a/contrib/lib/src/databases.rs +++ b/contrib/lib/src/databases.rs @@ -239,7 +239,7 @@ //! Returns a fairing that initializes the associated database connection //! pool. //! -//! * `fn get_one(&Manifest) -> Option` +//! * `fn get_one(&Cargo) -> Option` //! //! Retrieves a connection from the configured pool. Returns `Some` as long //! as `Self::fairing()` has been attached and there is at least one diff --git a/contrib/lib/src/helmet/helmet.rs b/contrib/lib/src/helmet/helmet.rs index e6a863eb..8ca38316 100644 --- a/contrib/lib/src/helmet/helmet.rs +++ b/contrib/lib/src/helmet/helmet.rs @@ -3,7 +3,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; use rocket::http::uncased::UncasedStr; use rocket::fairing::{Fairing, Info, Kind}; -use rocket::{Manifest, Request, Response}; +use rocket::{Cargo, Request, Response}; use crate::helmet::*; @@ -201,9 +201,9 @@ impl Fairing for SpaceHelmet { self.apply(res); } - fn on_launch(&self, manifest: &Manifest) { - if manifest.config().tls_enabled() - && !manifest.config().environment.is_dev() + fn on_launch(&self, cargo: &Cargo) { + if cargo.config().tls_enabled() + && !cargo.config().environment.is_dev() && !self.is_enabled::() { warn_!("Space Helmet: deploying with TLS without enabling HSTS."); diff --git a/contrib/lib/src/templates/mod.rs b/contrib/lib/src/templates/mod.rs index 4cd2c8c8..ada0b48c 100644 --- a/contrib/lib/src/templates/mod.rs +++ b/contrib/lib/src/templates/mod.rs @@ -141,7 +141,7 @@ use serde_json::{Value, to_value}; use std::borrow::Cow; use std::path::PathBuf; -use rocket::Manifest; +use rocket::Cargo; use rocket::request::Request; use rocket::fairing::Fairing; use rocket::response::{self, Content, Responder}; @@ -340,15 +340,15 @@ impl Template { /// /// # context.insert("test", "test"); /// # #[allow(unused_variables)] - /// let template = Template::show(client.manifest(), "index", context); + /// let template = Template::show(client.cargo(), "index", context); /// # }); /// } /// ``` #[inline] - pub fn show(manifest: &Manifest, name: S, context: C) -> Option + pub fn show(cargo: &Cargo, name: S, context: C) -> Option where S: Into>, C: Serialize { - let ctxt = manifest.state::().map(ContextManager::context).or_else(|| { + let ctxt = cargo.state::().map(ContextManager::context).or_else(|| { warn!("Uninitialized template context: missing fairing."); info!("To use templates, you must attach `Template::fairing()`."); info!("See the `Template` documentation for more information."); diff --git a/contrib/lib/tests/templates.rs b/contrib/lib/tests/templates.rs index 6d7e0361..ed51bfed 100644 --- a/contrib/lib/tests/templates.rs +++ b/contrib/lib/tests/templates.rs @@ -52,17 +52,17 @@ mod templates_tests { #[rocket::async_test] async fn test_tera_templates() { let mut rocket = rocket(); - let manifest = rocket.inspect().await; + let cargo = rocket.inspect().await; let mut map = HashMap::new(); map.insert("title", "_test_"); map.insert("content", "