mirror of
https://github.com/lisk77/comet.git
synced 2025-10-23 21:38:50 +00:00
fix: finally removed the storage.rsin the comet_ecs
This commit is contained in:
parent
7b6ccbe72c
commit
cae678747f
8 changed files with 45 additions and 10 deletions
34
crates/comet_structs/src/componet_set.rs
Normal file
34
crates/comet_structs/src/componet_set.rs
Normal 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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue