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/src/lib.rs | |
| parent | 3794c39bfd3fd4d03f9f89226fc9c1f16b096572 (diff) | |
feat(engine-ecs): replace Single deref impls with get* functions
Diffstat (limited to 'engine-ecs/src/lib.rs')
| -rw-r--r-- | engine-ecs/src/lib.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/engine-ecs/src/lib.rs b/engine-ecs/src/lib.rs index 3292bec..7bad923 100644 --- a/engine-ecs/src/lib.rs +++ b/engine-ecs/src/lib.rs @@ -312,13 +312,6 @@ impl World Some(EntityHandle::new(archetype, entity, self)) } - pub fn get_sole<SoleT: Sole>(&self) -> Option<Single<'_, SoleT>> - { - let ent = self.get_entity(SoleT::id())?; - - Some(Single::new(ent.get_with_id_mut(SoleT::id())?)) - } - pub fn event_submitter(&self) -> EventSubmitter<'_> { EventSubmitter::new(&self.data.new_events) @@ -363,8 +356,10 @@ impl World return StepResult::Stop; } - let Some(mut stats) = self.get_sole::<Stats>() else { - unreachable!(); // Reason: is added in World::new + let mut stats = Single::<Stats>::new(self); + + let Ok(stats) = stats.get_mut() else { + unreachable!(); // Stats is added in World::new }; stats.current_tick += 1; |
