From 7f969ecfa33f67edf4c5da77b64a0636c3c07fb6 Mon Sep 17 00:00:00 2001 From: Matthew Pomes Date: Tue, 20 Aug 2024 20:30:22 -0500 Subject: [PATCH] Fix doc-test by adding dyn_templates fake --- core/lib/src/rocket.rs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/core/lib/src/rocket.rs b/core/lib/src/rocket.rs index 6e1b9fd58b..3d2e5cc943 100644 --- a/core/lib/src/rocket.rs +++ b/core/lib/src/rocket.rs @@ -493,7 +493,20 @@ impl Rocket { /// /// ```rust,no_run /// # #[macro_use] extern crate rocket; - /// # extern crate rocket_dyn_templates; + /// # fn some_function() {} + /// # mod rocket_dyn_templates { + /// # use rocket::fairing::{Fairing, Info, Kind}; + /// # #[derive(Default)] + /// # pub struct Templates; + /// # impl Fairing for Templates { + /// # fn info(&self) -> Info { + /// # Info { name: "", kind: Kind::Ignite } + /// # } + /// # } + /// # impl Templates { + /// # pub fn register_function(&mut self, _name: &str, _f: impl Fn()) {} + /// # } + /// # } /// use rocket::Rocket; /// use rocket::fairing::AdHoc; /// use rocket_dyn_templates::Templates; @@ -502,11 +515,12 @@ impl Rocket { /// fn rocket() -> _ { /// rocket::build() /// .attach(Templates::default()) - /// .attach(AdHoc::on_ignite("Register new template function", |r| { - /// r.modify_fairing(|f: &mut Templates| { - /// f.register_function("some_function", some_function) - /// }) - /// }))) + /// .attach(AdHoc::on_ignite("Register new template function", |r| async move { + /// r.modify_fairings(|f: &mut Templates| { + /// f.register_function("some_function", some_function); + /// Ok::<(), ()>(()) + /// }).unwrap() + /// })) /// } /// ``` ///