summaryrefslogtreecommitdiff
path: root/ecs/examples/with_local.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-02-29 19:57:59 +0100
committerHampusM <hampus@hampusmat.com>2024-02-29 19:58:10 +0100
commit99ea5727ca4638efd2979218a128e56c0ce32c44 (patch)
treef167d9d88ad8b4cfe7089df3cc67e1be9b0f9a06 /ecs/examples/with_local.rs
parentbd627c91819ea98e551b29027de6eaaccbe45ed6 (diff)
feat(ecs): add iterating over queries non-mutably
Diffstat (limited to 'ecs/examples/with_local.rs')
-rw-r--r--ecs/examples/with_local.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/ecs/examples/with_local.rs b/ecs/examples/with_local.rs
index 334f129..b37a5c3 100644
--- a/ecs/examples/with_local.rs
+++ b/ecs/examples/with_local.rs
@@ -20,18 +20,18 @@ struct SayHelloState
cnt: usize,
}
-fn say_hello(mut query: Query<(SomeData,)>, mut state: Local<SayHelloState>)
+fn say_hello(query: Query<(SomeData,)>, mut state: Local<SayHelloState>)
{
- for (data,) in query.iter_mut() {
+ for (data,) in &query {
println!("Hello there. Count {}: {}", state.cnt, data.num);
state.cnt += 1;
}
}
-fn say_whats_up(mut query: Query<(SomeData, Name)>, mut state: Local<SayHelloState>)
+fn say_whats_up(query: Query<(SomeData, Name)>, mut state: Local<SayHelloState>)
{
- for (data, name) in query.iter_mut() {
+ for (data, name) in &query {
println!(
"Whats up, {}. Number is {}. Count {}",
name.name, data.num, state.cnt