diff options
Diffstat (limited to 'engine-ecs/examples')
| -rw-r--r-- | engine-ecs/examples/with_sole.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/engine-ecs/examples/with_sole.rs b/engine-ecs/examples/with_sole.rs index b76d9dc..16a5aba 100644 --- a/engine-ecs/examples/with_sole.rs +++ b/engine-ecs/examples/with_sole.rs @@ -20,15 +20,17 @@ fn count_ammo(query: Query<(&Ammo,)>, mut ammo_counter: Single<AmmoCounter>) for (ammo,) in &query { println!("Found {} ammo", ammo.ammo_left); - ammo_counter.counter += ammo.ammo_left; + ammo_counter.get_mut().unwrap().counter += ammo.ammo_left; } } fn print_total_ammo_count(ammo_counter: Single<AmmoCounter>) { - println!("Total ammo count: {}", ammo_counter.counter); + let ammo_count = ammo_counter.get().unwrap().counter; - assert_eq!(ammo_counter.counter, 19); + println!("Total ammo count: {}", ammo_count); + + assert_eq!(ammo_count, 19); } declare_entity!( |
