diff options
| author | HampusM <hampus@hampusmat.com> | 2026-07-10 15:36:06 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-07-10 15:36:06 +0200 |
| commit | d91156a08ea9f65d1e2660c50581a10603f29f58 (patch) | |
| tree | 07d95af541a9aa6f867817655c25006aad6352c2 /engine-ecs/examples | |
| parent | 3794c39bfd3fd4d03f9f89226fc9c1f16b096572 (diff) | |
feat(engine-ecs): replace Single deref impls with get* functions
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!( |
