diff options
Diffstat (limited to 'ecs/src/component/storage.rs')
| -rw-r--r-- | ecs/src/component/storage.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ecs/src/component/storage.rs b/ecs/src/component/storage.rs index d974967..dc38b6a 100644 --- a/ecs/src/component/storage.rs +++ b/ecs/src/component/storage.rs @@ -145,12 +145,12 @@ impl Storage Some(self.graph.get_node_by_id(id)?.archetype()) } - pub fn create_entity(&mut self, uid: Uid) -> Result<(), Error> + pub fn create_entity(&mut self, uid: Uid) -> Result<(), EntityAlreadyExistsError> { debug_assert_eq!(uid.kind(), UidKind::Entity); if self.entity_archetype_lookup.contains_key(&uid) { - return Err(Error::EntityAlreadyExists(uid)); + return Err(EntityAlreadyExistsError); } let empty_archetype_id = ArchetypeId::new_empty(); @@ -736,9 +736,6 @@ impl ArchetypeRefIter<'_, '_> #[derive(Debug, thiserror::Error)] pub enum Error { - #[error("Entity with ID {0:?} already exists")] - EntityAlreadyExists(Uid), - #[error("Entity with ID {0:?} does not exist")] EntityDoesNotExist(Uid), @@ -755,6 +752,10 @@ pub enum Error }, } +#[derive(Debug, thiserror::Error)] +#[error("Entity with already exists")] +pub struct EntityAlreadyExistsError; + #[derive(Debug)] struct ImaginaryArchetype { |
