fix: finally removed the storage.rsin the comet_ecs

This commit is contained in:
lisk77 2025-03-05 08:39:57 +01:00
parent 7b6ccbe72c
commit cae678747f
8 changed files with 45 additions and 10 deletions

View file

@ -0,0 +1,34 @@
use std::any::TypeId;
use std::collections::HashSet;
use std::hash::{Hash, Hasher};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ComponentSet {
set: HashSet<TypeId>
}
impl ComponentSet {
pub fn new() -> Self {
Self {
set: HashSet::new()
}
}
pub fn from_ids(ids: Vec<TypeId>) -> Self {
Self {
set: ids.into_iter().collect()
}
}
pub fn is_subset(&self, other: &ComponentSet) -> bool {
self.set.is_subset(&other.set)
}
}
impl Hash for ComponentSet {
fn hash<H: Hasher>(&self, state: &mut H) {
let mut types: Vec<TypeId> = self.set.iter().cloned().collect();
types.sort();
types.hash(state);
}
}

View file

@ -2,8 +2,10 @@ pub use column::Column;
pub use sparse_set::SparseSet;
pub use flat_map::FlatMap;
pub use component_storage::ComponentStorage;
pub use componet_set::ComponentSet;
mod column;
mod sparse_set;
mod flat_map;
mod component_storage;
mod component_storage;
mod componet_set;