Skip to content

Commit

Permalink
Fix doc-test by adding dyn_templates fake
Browse files Browse the repository at this point in the history
  • Loading branch information
the10thWiz committed Aug 21, 2024
1 parent a49e11d commit 7f969ec
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions core/lib/src/rocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,20 @@ impl Rocket<Build> {
///
/// ```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;
Expand All @@ -502,11 +515,12 @@ impl Rocket<Build> {
/// 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()
/// }))
/// }
/// ```
///
Expand Down

0 comments on commit 7f969ec

Please sign in to comment.