From 9532f40c7df96d656167fc6b49380c02a64a0159 Mon Sep 17 00:00:00 2001 From: CGMossa Date: Tue, 27 Apr 2021 13:09:35 +0200 Subject: [PATCH 01/14] Add suggestion for WithBundle by @TehPers. This addresses WithBundle missing WorldQuery implementation #2023. --- crates/bevy_ecs/src/query/filter.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/bevy_ecs/src/query/filter.rs b/crates/bevy_ecs/src/query/filter.rs index 4f4204ed90ab7..5b749490df250 100644 --- a/crates/bevy_ecs/src/query/filter.rs +++ b/crates/bevy_ecs/src/query/filter.rs @@ -243,6 +243,11 @@ impl<'a, T: Component> Fetch<'a> for WithoutFetch { pub struct WithBundle(PhantomData); +impl WorldQuery for WithBundle { + type Fetch = WithBundleFetch; + type State = WithBundleState; +} + pub struct WithBundleFetch { is_dense: bool, marker: PhantomData, From d42ecfe8ff0fa7c7c54cfc704037be279f35a421 Mon Sep 17 00:00:00 2001 From: CGMossa Date: Tue, 27 Apr 2021 13:10:06 +0200 Subject: [PATCH 02/14] Added an example to illustrate WithBundle --- Cargo.toml | 4 +++ examples/ecs/query_bundle.rs | 59 ++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 examples/ecs/query_bundle.rs diff --git a/Cargo.toml b/Cargo.toml index 217249920a53a..c64df3892041c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -298,6 +298,10 @@ path = "examples/ecs/system_param.rs" name = "timers" path = "examples/ecs/timers.rs" +[[example]] +name = "query_bundle" +path = "examples/ecs/query_bundle.rs" + # Games [[example]] name = "alien_cake_addict" diff --git a/examples/ecs/query_bundle.rs b/examples/ecs/query_bundle.rs new file mode 100644 index 0000000000000..b34779bb29ab6 --- /dev/null +++ b/examples/ecs/query_bundle.rs @@ -0,0 +1,59 @@ +use bevy::{ecs::schedule::RunOnce, prelude::*}; + +fn main() { + App::build() + .insert_resource(bevy::app::ScheduleRunnerSettings::run_once()) + .add_plugins(MinimalPlugins) + .add_startup_system(setup.system()) + .add_stage("diagnostic", SystemStage::single_threaded()) + .add_system_to_stage( + "diagnostic", + query_component_without_bundle + .system() + .with_run_criteria(RunOnce::default()), + ) + .add_system_to_stage( + "diagnostic", + test_query_bundle + .system() + .with_run_criteria(RunOnce::default()), + ) + .run(); +} + +#[derive(Debug)] +struct Dummy(usize); + +#[derive(Debug)] +struct DummyToo(usize); + +#[derive(Debug, Bundle)] +struct DummyBundle { + dummy_component: Dummy, + // dummy_too_component: DummyToo, +} + +/// Sets up entites with [Dummy] component as part of a bundle and isolated. +fn setup(mut commands: Commands) { + commands.spawn().insert(Dummy(111)); + + commands.spawn().insert_bundle(DummyBundle { + dummy_component: Dummy(222), + // dummy_too_component: DummyToo(333), + }); +} + +fn query_component_without_bundle(query: Query<&Dummy>) { + println!("Show all components"); + // this will necessarily have to print both components. + query.iter().for_each(|x| { + dbg!(x); + }); +} +fn test_query_bundle(query: Query<&Dummy, WithBundle>) { + println!("Print component initated from bundle."); + // this should only print `Dummy(222)`. + query.iter().for_each(|x| { + dbg!(x); + }); +} From d9020d5838827197afe7ce82fb31239a73620bb8 Mon Sep 17 00:00:00 2001 From: CGMossa Date: Tue, 27 Apr 2021 13:52:19 +0200 Subject: [PATCH 03/14] Fix typo and logging instead of wild printing. --- examples/ecs/query_bundle.rs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/examples/ecs/query_bundle.rs b/examples/ecs/query_bundle.rs index b34779bb29ab6..97c9599a272bb 100644 --- a/examples/ecs/query_bundle.rs +++ b/examples/ecs/query_bundle.rs @@ -1,9 +1,19 @@ -use bevy::{ecs::schedule::RunOnce, prelude::*}; +use bevy::{ + // diagnostic::LogDiagnosticsPlugin, + ecs::schedule::RunOnce, + log::{LogPlugin, LogSettings}, + prelude::*, +}; fn main() { App::build() - .insert_resource(bevy::app::ScheduleRunnerSettings::run_once()) + .insert_resource(LogSettings { + level: bevy::log::Level::DEBUG, + ..Default::default() + }) + .add_plugin(LogPlugin) .add_plugins(MinimalPlugins) + .insert_resource(bevy::app::ScheduleRunnerSettings::run_once()) .add_startup_system(setup.system()) .add_stage("diagnostic", SystemStage::single_threaded()) .add_system_to_stage( @@ -30,7 +40,7 @@ struct DummyToo(usize); #[derive(Debug, Bundle)] struct DummyBundle { dummy_component: Dummy, - // dummy_too_component: DummyToo, + dummy_too_component: DummyToo, } /// Sets up entites with [Dummy] component as part of a bundle and isolated. @@ -39,21 +49,21 @@ fn setup(mut commands: Commands) { commands.spawn().insert_bundle(DummyBundle { dummy_component: Dummy(222), - // dummy_too_component: DummyToo(333), + dummy_too_component: DummyToo(333), }); } fn query_component_without_bundle(query: Query<&Dummy>) { - println!("Show all components"); + debug!("Show all components"); // this will necessarily have to print both components. query.iter().for_each(|x| { - dbg!(x); + debug!("{:?}", x); }); } fn test_query_bundle(query: Query<&Dummy, WithBundle>) { - println!("Print component initated from bundle."); + debug!("Print component initiated from bundle."); // this should only print `Dummy(222)`. query.iter().for_each(|x| { - dbg!(x); + debug!("{:?}", x); }); } From de6b7b4492617a58241f3b3b4efc09e7849fa0b4 Mon Sep 17 00:00:00 2001 From: Mossa Date: Tue, 27 Apr 2021 22:04:59 +0200 Subject: [PATCH 04/14] Changed based on feedback. --- examples/ecs/query_bundle.rs | 37 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/examples/ecs/query_bundle.rs b/examples/ecs/query_bundle.rs index 97c9599a272bb..9ef7e91940ac8 100644 --- a/examples/ecs/query_bundle.rs +++ b/examples/ecs/query_bundle.rs @@ -1,5 +1,4 @@ use bevy::{ - // diagnostic::LogDiagnosticsPlugin, ecs::schedule::RunOnce, log::{LogPlugin, LogSettings}, prelude::*, @@ -7,13 +6,7 @@ use bevy::{ fn main() { App::build() - .insert_resource(LogSettings { - level: bevy::log::Level::DEBUG, - ..Default::default() - }) .add_plugin(LogPlugin) - .add_plugins(MinimalPlugins) - .insert_resource(bevy::app::ScheduleRunnerSettings::run_once()) .add_startup_system(setup.system()) .add_stage("diagnostic", SystemStage::single_threaded()) .add_system_to_stage( @@ -32,38 +25,38 @@ fn main() { } #[derive(Debug)] -struct Dummy(usize); +struct Name(String); #[derive(Debug)] -struct DummyToo(usize); +struct Age(usize); #[derive(Debug, Bundle)] -struct DummyBundle { - dummy_component: Dummy, - dummy_too_component: DummyToo, +struct PersonBundle { + name: Name, + age: Age, } /// Sets up entites with [Dummy] component as part of a bundle and isolated. fn setup(mut commands: Commands) { - commands.spawn().insert(Dummy(111)); + commands.spawn().insert(Name("Steve".to_string())); - commands.spawn().insert_bundle(DummyBundle { - dummy_component: Dummy(222), - dummy_too_component: DummyToo(333), + commands.spawn().insert_bundle(PersonBundle { + name: Name("Bob".to_string()), + age: Age(40), }); } -fn query_component_without_bundle(query: Query<&Dummy>) { - debug!("Show all components"); +fn query_component_without_bundle(query: Query<&Name>) { + info!("Show all components"); // this will necessarily have to print both components. query.iter().for_each(|x| { - debug!("{:?}", x); + info!("{:?}", x); }); } -fn test_query_bundle(query: Query<&Dummy, WithBundle>) { - debug!("Print component initiated from bundle."); +fn test_query_bundle(query: Query<&Name, WithBundle>) { + info!("Print component initiated from bundle."); // this should only print `Dummy(222)`. query.iter().for_each(|x| { - debug!("{:?}", x); + info!("{:?}", x); }); } From 4274b7e420544ec5ac2ab21ec842b90aa226bbca Mon Sep 17 00:00:00 2001 From: Mossa Date: Tue, 27 Apr 2021 22:07:43 +0200 Subject: [PATCH 05/14] Updated documentation, thanks @NiklasEi --- crates/bevy_ecs/src/bundle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_ecs/src/bundle.rs b/crates/bevy_ecs/src/bundle.rs index 3c2d7e39184ef..d640581c969aa 100644 --- a/crates/bevy_ecs/src/bundle.rs +++ b/crates/bevy_ecs/src/bundle.rs @@ -12,7 +12,7 @@ use std::{any::TypeId, collections::HashMap}; /// An ordered collection of components, commonly used for spawning entities, and adding and /// removing components in bulk. /// -/// You cannot query for a bundle, only individual components within it. +/// In order to query for components in a bundle use [crate::query::WithBundle]. /// /// Typically, you will simply use `#[derive(Bundle)]` when creating your own `Bundle`. /// The `Bundle` trait is automatically implemented for tuples of components: From 1bee431c4b47f725fcc373bc33337ad533a7d4ab Mon Sep 17 00:00:00 2001 From: CGMossa Date: Wed, 28 Apr 2021 09:52:04 +0200 Subject: [PATCH 06/14] Update examples/ecs/query_bundle.rs Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com> --- examples/ecs/query_bundle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ecs/query_bundle.rs b/examples/ecs/query_bundle.rs index 9ef7e91940ac8..4e48934508ef9 100644 --- a/examples/ecs/query_bundle.rs +++ b/examples/ecs/query_bundle.rs @@ -36,7 +36,7 @@ struct PersonBundle { age: Age, } -/// Sets up entites with [Dummy] component as part of a bundle and isolated. +/// Sets up entities with [Name] component as part of a bundle and isolated. fn setup(mut commands: Commands) { commands.spawn().insert(Name("Steve".to_string())); From 9012a44d0c2de9164dd5484242ba7a8021dfdc44 Mon Sep 17 00:00:00 2001 From: CGMossa Date: Wed, 28 Apr 2021 09:52:15 +0200 Subject: [PATCH 07/14] Update examples/ecs/query_bundle.rs Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com> --- examples/ecs/query_bundle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ecs/query_bundle.rs b/examples/ecs/query_bundle.rs index 4e48934508ef9..4c8aac754f898 100644 --- a/examples/ecs/query_bundle.rs +++ b/examples/ecs/query_bundle.rs @@ -55,7 +55,7 @@ fn query_component_without_bundle(query: Query<&Name>) { } fn test_query_bundle(query: Query<&Name, WithBundle>) { info!("Print component initiated from bundle."); - // this should only print `Dummy(222)`. + // this should only print `Name("Bob")`. query.iter().for_each(|x| { info!("{:?}", x); }); From 5e7f05d55c8816b452e1c42abe2eaa28b29f3501 Mon Sep 17 00:00:00 2001 From: CGMossa Date: Wed, 28 Apr 2021 09:52:22 +0200 Subject: [PATCH 08/14] Update examples/ecs/query_bundle.rs Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com> --- examples/ecs/query_bundle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ecs/query_bundle.rs b/examples/ecs/query_bundle.rs index 4c8aac754f898..d5cf8e4572710 100644 --- a/examples/ecs/query_bundle.rs +++ b/examples/ecs/query_bundle.rs @@ -1,6 +1,6 @@ use bevy::{ ecs::schedule::RunOnce, - log::{LogPlugin, LogSettings}, + log::LogPlugin, prelude::*, }; From 41ec0dd6c0f5d3ab292fb1c1e5ec92db84f72f36 Mon Sep 17 00:00:00 2001 From: CGMossa Date: Wed, 28 Apr 2021 09:53:02 +0200 Subject: [PATCH 09/14] Add query_bundle to examples. --- examples/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/examples/README.md b/examples/README.md index 7908932a77507..196115232904d 100644 --- a/examples/README.md +++ b/examples/README.md @@ -32,6 +32,8 @@ git checkout v0.4.0 ## Table of Contents +- [Examples](#examples) + - [Table of Contents](#table-of-contents) - [The Bare Minimum](#the-bare-minimum) - [Hello, World!](#hello-world) - [Cross-Platform Examples](#cross-platform-examples) @@ -53,8 +55,15 @@ git checkout v0.4.0 - [Window](#window) - [Platform-Specific Examples](#platform-specific-examples) - [Android](#android) + - [Setup](#setup) + - [Build & Run](#build--run) + - [Old phones](#old-phones) - [iOS](#ios) + - [Setup](#setup-1) + - [Build & Run](#build--run-1) - [WASM](#wasm) + - [Setup](#setup-2) + - [Build & Run](#build--run-2) # The Bare Minimum @@ -145,6 +154,7 @@ Example | File | Description `fixed_timestep` | [`ecs/fixed_timestep.rs`](./ecs/fixed_timestep.rs) | Shows how to create systems that run every fixed timestep, rather than every tick `hierarchy` | [`ecs/hierarchy.rs`](./ecs/hierarchy.rs) | Creates a hierarchy of parents and children entities `parallel_query` | [`ecs/parallel_query.rs`](./ecs/parallel_query.rs) | Illustrates parallel queries with `ParallelIterator` +`query_bundle` | [`ecs/query_bundle.rs`](./ecs/query_bundle.rs) | Shows how to query entities that contain components in a `Bundle` `removal_detection` | [`ecs/removal_detection.rs`](./ecs/removal_detection.rs) | Query for entities that had a specific component removed in a previous stage during the current frame. `startup_system` | [`ecs/startup_system.rs`](./ecs/startup_system.rs) | Demonstrates a startup system (one that runs once when the app starts up) `state` | [`ecs/state.rs`](./ecs/state.rs) | Illustrates how to use States to control transitioning from a Menu state to an InGame state From b5bcc5a1d8d46726b7d9b5f41f545906fc17a176 Mon Sep 17 00:00:00 2001 From: CGMossa Date: Wed, 28 Apr 2021 09:55:08 +0200 Subject: [PATCH 10/14] Change wording in comments to be less vague --- examples/ecs/query_bundle.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/ecs/query_bundle.rs b/examples/ecs/query_bundle.rs index d5cf8e4572710..a4fc123b86829 100644 --- a/examples/ecs/query_bundle.rs +++ b/examples/ecs/query_bundle.rs @@ -11,13 +11,13 @@ fn main() { .add_stage("diagnostic", SystemStage::single_threaded()) .add_system_to_stage( "diagnostic", - query_component_without_bundle + query_component_without_person_bundle .system() .with_run_criteria(RunOnce::default()), ) .add_system_to_stage( "diagnostic", - test_query_bundle + query_person_bundle .system() .with_run_criteria(RunOnce::default()), ) @@ -36,7 +36,8 @@ struct PersonBundle { age: Age, } -/// Sets up entities with [Name] component as part of a bundle and isolated. +/// Sets up two entities, one with a [Name] component as part of a bundle, +/// and one entity with [Name] only. fn setup(mut commands: Commands) { commands.spawn().insert(Name("Steve".to_string())); @@ -46,14 +47,14 @@ fn setup(mut commands: Commands) { }); } -fn query_component_without_bundle(query: Query<&Name>) { +fn query_component_without_person_bundle(query: Query<&Name>) { info!("Show all components"); // this will necessarily have to print both components. query.iter().for_each(|x| { info!("{:?}", x); }); } -fn test_query_bundle(query: Query<&Name, WithBundle>) { +fn query_person_bundle(query: Query<&Name, WithBundle>) { info!("Print component initiated from bundle."); // this should only print `Name("Bob")`. query.iter().for_each(|x| { From 53600bf1f8698f44ece54ca023d4512d5467cccd Mon Sep 17 00:00:00 2001 From: CGMossa Date: Wed, 28 Apr 2021 09:59:47 +0200 Subject: [PATCH 11/14] Remove "diagnostic" stage. This change disappeared and now I bring it back again. --- examples/ecs/query_bundle.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/examples/ecs/query_bundle.rs b/examples/ecs/query_bundle.rs index a4fc123b86829..9dd634fd8fb16 100644 --- a/examples/ecs/query_bundle.rs +++ b/examples/ecs/query_bundle.rs @@ -1,22 +1,15 @@ -use bevy::{ - ecs::schedule::RunOnce, - log::LogPlugin, - prelude::*, -}; +use bevy::{ecs::schedule::RunOnce, log::LogPlugin, prelude::*}; fn main() { App::build() .add_plugin(LogPlugin) .add_startup_system(setup.system()) - .add_stage("diagnostic", SystemStage::single_threaded()) - .add_system_to_stage( - "diagnostic", + .add_system( query_component_without_person_bundle .system() .with_run_criteria(RunOnce::default()), ) - .add_system_to_stage( - "diagnostic", + .add_system( query_person_bundle .system() .with_run_criteria(RunOnce::default()), @@ -36,7 +29,7 @@ struct PersonBundle { age: Age, } -/// Sets up two entities, one with a [Name] component as part of a bundle, +/// Sets up two entities, one with a [Name] component as part of a bundle, /// and one entity with [Name] only. fn setup(mut commands: Commands) { commands.spawn().insert(Name("Steve".to_string())); From e93894e4f7ffd3b267f5ebae4bd2581515567220 Mon Sep 17 00:00:00 2001 From: CGMossa Date: Wed, 28 Apr 2021 10:08:34 +0200 Subject: [PATCH 12/14] Change wording and add print systems to a systemset --- examples/ecs/query_bundle.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/examples/ecs/query_bundle.rs b/examples/ecs/query_bundle.rs index 9dd634fd8fb16..4084a5ebbd3e1 100644 --- a/examples/ecs/query_bundle.rs +++ b/examples/ecs/query_bundle.rs @@ -4,14 +4,10 @@ fn main() { App::build() .add_plugin(LogPlugin) .add_startup_system(setup.system()) - .add_system( - query_component_without_person_bundle - .system() - .with_run_criteria(RunOnce::default()), - ) - .add_system( - query_person_bundle - .system() + .add_system_set( + SystemSet::new() + .with_system(query_component_without_person_bundle.system()) + .with_system(query_person_bundle.system()) .with_run_criteria(RunOnce::default()), ) .run(); @@ -41,14 +37,14 @@ fn setup(mut commands: Commands) { } fn query_component_without_person_bundle(query: Query<&Name>) { - info!("Show all components"); + info!("Show all entites with component `Name`"); // this will necessarily have to print both components. query.iter().for_each(|x| { info!("{:?}", x); }); } fn query_person_bundle(query: Query<&Name, WithBundle>) { - info!("Print component initiated from bundle."); + info!("Print `Name` component residing in entities that are added via `PersonBundle`."); // this should only print `Name("Bob")`. query.iter().for_each(|x| { info!("{:?}", x); From f9e98300ff0bc86a6025b9cfe8ee71b41517da68 Mon Sep 17 00:00:00 2001 From: Mossa Date: Wed, 28 Apr 2021 20:55:56 +0200 Subject: [PATCH 13/14] Add system label for consistency of debug output. --- examples/ecs/query_bundle.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/examples/ecs/query_bundle.rs b/examples/ecs/query_bundle.rs index 4084a5ebbd3e1..f909599ba94aa 100644 --- a/examples/ecs/query_bundle.rs +++ b/examples/ecs/query_bundle.rs @@ -1,13 +1,28 @@ use bevy::{ecs::schedule::RunOnce, log::LogPlugin, prelude::*}; +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, SystemLabel)] +enum DiagnosticSteps { + AllComponents, + BundleComponents, +} + fn main() { App::build() .add_plugin(LogPlugin) .add_startup_system(setup.system()) .add_system_set( SystemSet::new() - .with_system(query_component_without_person_bundle.system()) - .with_system(query_person_bundle.system()) + .with_system( + query_component_without_person_bundle + .system() + .label(DiagnosticSteps::AllComponents), + ) + .with_system( + query_person_bundle + .system() + .label(DiagnosticSteps::BundleComponents) + .after(DiagnosticSteps::AllComponents), + ) .with_run_criteria(RunOnce::default()), ) .run(); From 1eac76d40da466da8e6ebe9b5d8c06839f1c5fc8 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Wed, 28 Apr 2021 12:30:25 -0700 Subject: [PATCH 14/14] make even more minimal --- examples/ecs/query_bundle.rs | 49 ++++++++++++------------------------ 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/examples/ecs/query_bundle.rs b/examples/ecs/query_bundle.rs index f909599ba94aa..0691c0d849234 100644 --- a/examples/ecs/query_bundle.rs +++ b/examples/ecs/query_bundle.rs @@ -1,33 +1,17 @@ -use bevy::{ecs::schedule::RunOnce, log::LogPlugin, prelude::*}; - -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, SystemLabel)] -enum DiagnosticSteps { - AllComponents, - BundleComponents, -} +use bevy::{log::LogPlugin, prelude::*}; fn main() { App::build() .add_plugin(LogPlugin) .add_startup_system(setup.system()) - .add_system_set( - SystemSet::new() - .with_system( - query_component_without_person_bundle - .system() - .label(DiagnosticSteps::AllComponents), - ) - .with_system( - query_person_bundle - .system() - .label(DiagnosticSteps::BundleComponents) - .after(DiagnosticSteps::AllComponents), - ) - .with_run_criteria(RunOnce::default()), - ) + .add_system(log_names.system().label(LogNamesSystem)) + .add_system(log_person_bundles.system().after(LogNamesSystem)) .run(); } +#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemLabel)] +struct LogNamesSystem; + #[derive(Debug)] struct Name(String); @@ -44,24 +28,23 @@ struct PersonBundle { /// and one entity with [Name] only. fn setup(mut commands: Commands) { commands.spawn().insert(Name("Steve".to_string())); - commands.spawn().insert_bundle(PersonBundle { name: Name("Bob".to_string()), age: Age(40), }); } -fn query_component_without_person_bundle(query: Query<&Name>) { - info!("Show all entites with component `Name`"); +fn log_names(query: Query<&Name>) { + info!("Log all entities with `Name` component"); // this will necessarily have to print both components. - query.iter().for_each(|x| { - info!("{:?}", x); - }); + for name in query.iter() { + info!("{:?}", name); + } } -fn query_person_bundle(query: Query<&Name, WithBundle>) { - info!("Print `Name` component residing in entities that are added via `PersonBundle`."); +fn log_person_bundles(query: Query<&Name, WithBundle>) { + info!("Log `Name` components from entities that have all components in `PersonBundle`."); // this should only print `Name("Bob")`. - query.iter().for_each(|x| { - info!("{:?}", x); - }); + for name in query.iter() { + info!("{:?}", name); + } }