diff options
Diffstat (limited to 'ecs/src/lib.rs')
-rw-r--r-- | ecs/src/lib.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ecs/src/lib.rs b/ecs/src/lib.rs index db82d91..8a5de64 100644 --- a/ecs/src/lib.rs +++ b/ecs/src/lib.rs @@ -353,12 +353,12 @@ pub struct SoleAlreadyExistsError(pub &'static str); #[derive(Debug, Default)] struct SoleStorage { - storage: HashMap<TypeId, Lock<Box<dyn Sole>>>, + storage: HashMap<TypeId, Arc<Lock<Box<dyn Sole>>>>, } impl SoleStorage { - fn get<SoleT: Sole>(&self) -> Option<&Lock<Box<dyn Sole>>> + fn get<SoleT: Sole>(&self) -> Option<&Arc<Lock<Box<dyn Sole>>>> { self.storage.get(&TypeId::of::<SoleT>()) } @@ -371,7 +371,10 @@ impl SoleStorage return Err(SoleAlreadyExistsError(type_name::<SoleT>())); } - self.storage.insert(sole_type_id, Lock::new(Box::new(sole))); + // TODO: Reconsider this maybe? + #[allow(clippy::arc_with_non_send_sync)] + self.storage + .insert(sole_type_id, Arc::new(Lock::new(Box::new(sole)))); Ok(()) } |