From 99ea5727ca4638efd2979218a128e56c0ce32c44 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 29 Feb 2024 19:57:59 +0100 Subject: feat(ecs): add iterating over queries non-mutably --- ecs/examples/with_local.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ecs/examples/with_local.rs') 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) +fn say_hello(query: Query<(SomeData,)>, mut state: Local) { - 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) +fn say_whats_up(query: Query<(SomeData, Name)>, mut state: Local) { - for (data, name) in query.iter_mut() { + for (data, name) in &query { println!( "Whats up, {}. Number is {}. Count {}", name.name, data.num, state.cnt -- cgit v1.2.3-18-g5258