summaryrefslogtreecommitdiff
path: root/ecs/src/component
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/src/component')
-rw-r--r--ecs/src/component/storage.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/ecs/src/component/storage.rs b/ecs/src/component/storage.rs
index 4b7a6b4..5ce587f 100644
--- a/ecs/src/component/storage.rs
+++ b/ecs/src/component/storage.rs
@@ -14,7 +14,6 @@ use crate::component::{
};
use crate::type_name::TypeName;
use crate::uid::Uid;
-use crate::util::Sortable;
use crate::EntityComponent;
#[derive(Debug, Default)]
@@ -27,22 +26,21 @@ pub struct Storage
impl Storage
{
- pub fn iter_archetypes_with_comps<CompMetadataList>(
+ pub fn iter_archetypes_with_comps(
&self,
- mut comp_metadata_list: CompMetadataList,
+ comp_metadata: impl AsRef<[ComponentMetadata]>,
) -> ArchetypeRefIter<'_>
- where
- CompMetadataList: Sortable<Item = ComponentMetadata>,
- CompMetadataList: AsRef<[ComponentMetadata]>,
{
- comp_metadata_list.sort_by_key_b(|metadata| metadata.id);
+ debug_assert!(comp_metadata
+ .as_ref()
+ .is_sorted_by_key(|metadata| metadata.id));
- let archetype_id = ArchetypeId::from_components_metadata(&comp_metadata_list);
+ let archetype_id = ArchetypeId::from_components_metadata(&comp_metadata);
if !self.archetype_lookup.borrow().contains_key(&archetype_id) {
self.archetype_lookup.borrow_mut().insert(
archetype_id,
- self.create_populated_archetype_lookup_entry(comp_metadata_list.as_ref()),
+ self.create_populated_archetype_lookup_entry(comp_metadata.as_ref()),
);
}