diff --git a/crates/bevy_core/src/time/stopwatch.rs b/crates/bevy_core/src/time/stopwatch.rs index b00e3bee005ed..8aa1e974c9647 100644 --- a/crates/bevy_core/src/time/stopwatch.rs +++ b/crates/bevy_core/src/time/stopwatch.rs @@ -11,11 +11,14 @@ use bevy_utils::Duration; /// use std::time::Duration; /// let mut stopwatch = Stopwatch::new(); /// assert_eq!(stopwatch.elapsed_secs(), 0.0); +/// /// stopwatch.tick(Duration::from_secs_f32(1.0)); // tick one second /// assert_eq!(stopwatch.elapsed_secs(), 1.0); +/// /// stopwatch.pause(); /// stopwatch.tick(Duration::from_secs_f32(1.0)); // paused stopwatches don't tick /// assert_eq!(stopwatch.elapsed_secs(), 1.0); +/// /// stopwatch.reset(); // reset the stopwatch /// assert!(stopwatch.paused()); /// assert_eq!(stopwatch.elapsed_secs(), 0.0); diff --git a/crates/bevy_ecs/src/bundle.rs b/crates/bevy_ecs/src/bundle.rs index 097a48d2dacc4..3c2d7e39184ef 100644 --- a/crates/bevy_ecs/src/bundle.rs +++ b/crates/bevy_ecs/src/bundle.rs @@ -34,7 +34,7 @@ use std::{any::TypeId, collections::HashMap}; /// #[bundle] /// a: A, /// z: String, -/// } +/// } /// ``` /// /// # Safety diff --git a/crates/bevy_ecs/src/query/filter.rs b/crates/bevy_ecs/src/query/filter.rs index d745f456d59ce..4f4204ed90ab7 100644 --- a/crates/bevy_ecs/src/query/filter.rs +++ b/crates/bevy_ecs/src/query/filter.rs @@ -610,18 +610,21 @@ impl_tick_filter!( /// /// Example: /// ``` + /// # use bevy_ecs::system::IntoSystem; /// # use bevy_ecs::system::Query; /// # use bevy_ecs::query::Added; /// # /// # #[derive(Debug)] /// # struct Name {}; /// # struct Transform {}; - /// # + /// /// fn print_add_name_component(query: Query<&Name, Added>) { /// for name in query.iter() { /// println!("Named entity created: {:?}", name) /// } /// } + /// + /// # print_add_name_component.system(); /// ``` Added, AddedState, @@ -642,18 +645,21 @@ impl_tick_filter!( /// /// Example: /// ``` + /// # use bevy_ecs::system::IntoSystem; /// # use bevy_ecs::system::Query; /// # use bevy_ecs::query::Changed; /// # /// # #[derive(Debug)] /// # struct Name {}; /// # struct Transform {}; - /// # + /// /// fn print_moving_objects_system(query: Query<&Name, Changed>) { /// for name in query.iter() { /// println!("Entity Moved: {:?}", name); /// } /// } + /// + /// # print_moving_objects_system.system(); /// ``` Changed, ChangedState, diff --git a/crates/bevy_ecs/src/system/system_param.rs b/crates/bevy_ecs/src/system/system_param.rs index e5c629eabbb28..f6db10ba5ad75 100644 --- a/crates/bevy_ecs/src/system/system_param.rs +++ b/crates/bevy_ecs/src/system/system_param.rs @@ -32,6 +32,8 @@ use std::{ /// fn my_system(param: MyParam) { /// // Access the resource through `param.foo` /// } +/// +/// # my_system.system(); /// ``` pub trait SystemParam: Sized { type Fetch: for<'a> SystemParamFetch<'a>; @@ -573,10 +575,17 @@ impl<'a, T: Component + FromWorld> SystemParamFetch<'a> for LocalState { /// /// Basic usage: /// -/// ```ignore +/// ``` +/// # use bevy_ecs::system::IntoSystem; +/// # use bevy_ecs::system::RemovedComponents; +/// # +/// # struct MyComponent; +/// /// fn react_on_removal(removed: RemovedComponents) { -/// removed.iter().for_each(|removed_entity| println!("{}", removed_entity)); +/// removed.iter().for_each(|removed_entity| println!("{:?}", removed_entity)); /// } +/// +/// # react_on_removal.system(); /// ``` pub struct RemovedComponents<'a, T> { world: &'a World, diff --git a/examples/3d/spawner.rs b/examples/3d/spawner.rs index 5b8433ae7ced3..4cc9e3b44f370 100644 --- a/examples/3d/spawner.rs +++ b/examples/3d/spawner.rs @@ -7,7 +7,7 @@ use rand::{rngs::StdRng, Rng, SeedableRng}; /// This example spawns a large number of cubes, each with its own changing position and material /// This is intended to be a stress test of bevy's ability to render many objects with different /// properties For the best results, run it in release mode: -/// ``` +/// ```bash /// cargo run --example spawner --release /// ``` /// NOTE: Bevy still has a number of optimizations to do in this area. Expect the