summaryrefslogtreecommitdiff
path: root/ecs/src/component/storage.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/src/component/storage.rs')
-rw-r--r--ecs/src/component/storage.rs62
1 files changed, 31 insertions, 31 deletions
diff --git a/ecs/src/component/storage.rs b/ecs/src/component/storage.rs
index 42e0e4f..cff50cf 100644
--- a/ecs/src/component/storage.rs
+++ b/ecs/src/component/storage.rs
@@ -16,37 +16,6 @@ pub struct Storage
pending_archetype_lookup_entries: Vec<Vec<ComponentId>>,
}
-#[derive(Debug)]
-pub struct ArchetypeRefIter<'component_storage>
-{
- inner: SliceIter<'component_storage, usize>,
- archetypes: &'component_storage [Archetype],
-}
-
-impl<'component_storage> ArchetypeRefIter<'component_storage>
-{
- fn new_empty() -> Self
- {
- Self { inner: [].iter(), archetypes: &[] }
- }
-}
-
-impl<'component_storage> Iterator for ArchetypeRefIter<'component_storage>
-{
- type Item = &'component_storage Archetype;
-
- fn next(&mut self) -> Option<Self::Item>
- {
- let archetype_index = *self.inner.next()?;
-
- Some(
- self.archetypes
- .get(archetype_index)
- .expect("Archetype index in archetype lookup entry was not found"),
- )
- }
-}
-
impl Storage
{
pub fn find_entities(
@@ -185,6 +154,37 @@ pub struct Archetype
pub components: Vec<Vec<EntityComponent>>,
}
+#[derive(Debug)]
+pub struct ArchetypeRefIter<'component_storage>
+{
+ inner: SliceIter<'component_storage, usize>,
+ archetypes: &'component_storage [Archetype],
+}
+
+impl<'component_storage> ArchetypeRefIter<'component_storage>
+{
+ fn new_empty() -> Self
+ {
+ Self { inner: [].iter(), archetypes: &[] }
+ }
+}
+
+impl<'component_storage> Iterator for ArchetypeRefIter<'component_storage>
+{
+ type Item = &'component_storage Archetype;
+
+ fn next(&mut self) -> Option<Self::Item>
+ {
+ let archetype_index = *self.inner.next()?;
+
+ Some(
+ self.archetypes
+ .get(archetype_index)
+ .expect("Archetype index in archetype lookup entry was not found"),
+ )
+ }
+}
+
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
struct ArchetypeComponentsHash
{