From 7fe8e9ea15fac647fe8655ee096a9aa5703a97c6 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 6 Jun 2026 18:55:07 +0200 Subject: feat(engine-ecs): remove Uid kinds --- engine-ecs/src/entity.rs | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'engine-ecs/src/entity.rs') diff --git a/engine-ecs/src/entity.rs b/engine-ecs/src/entity.rs index ad9f179..f551de1 100644 --- a/engine-ecs/src/entity.rs +++ b/engine-ecs/src/entity.rs @@ -18,7 +18,7 @@ use crate::pair::{ Pair, WithWildcard as PairWithWildcard, }; -use crate::uid::{Kind as UidKind, Uid}; +use crate::uid::Uid; use crate::{EntityComponentRef, World}; pub mod obtainer; @@ -47,12 +47,12 @@ impl<'a> Handle<'a> /// /// # Panics /// Will panic if: - /// - The component's ID is not a component ID + /// - The component's ID is pair /// - The component is mutably borrowed elsewhere #[must_use] pub fn get(&self) -> Option> { - assert_eq!(ComponentT::id().kind(), UidKind::Component); + assert!(!ComponentT::id().is_pair()); let component = self.get_matching_components(ComponentT::id()).next()?; @@ -73,14 +73,14 @@ impl<'a> Handle<'a> /// /// # Panics /// Will panic if: - /// - The component's ID is not a component ID + /// - The component's ID is a pair /// - The component is borrowed elsewhere #[must_use] pub fn get_mut( &self, ) -> Option> { - assert_eq!(ComponentT::id().kind(), UidKind::Component); + assert!(!ComponentT::id().is_pair()); let component = self.get_matching_components(ComponentT::id()).next()?; @@ -100,7 +100,6 @@ impl<'a> Handle<'a> /// /// # Panics /// Will panic if: - /// - The ID is not a component/pair ID /// - The component is borrowed mutably elsewhere /// - The component type is incorrect #[must_use] @@ -109,11 +108,6 @@ impl<'a> Handle<'a> id: Uid, ) -> Option> { - assert!( - matches!(id.kind(), UidKind::Component | UidKind::Pair), - "ID {id:?} is not a component/pair ID" - ); - let component = self.get_matching_components(id).next()?; Some( @@ -133,7 +127,6 @@ impl<'a> Handle<'a> /// /// # Panics /// Will panic if: - /// - The ID is not a component/pair ID /// - The component is borrowed elsewhere /// - The component type is incorrect #[must_use] @@ -142,11 +135,6 @@ impl<'a> Handle<'a> id: Uid, ) -> Option> { - assert!( - matches!(id.kind(), UidKind::Component | UidKind::Pair), - "ID {id:?} is not a component/pair ID" - ); - let component = self.get_matching_components(id).next()?; Some( @@ -267,7 +255,7 @@ impl Declaration pub const fn new(create_func: fn(&mut World)) -> Self { Self { - uid: LazyLock::new(|| Uid::new_unique(UidKind::Entity)), + uid: LazyLock::new(|| Uid::new_unique()), create_func, } } -- cgit v1.2.3-18-g5258