diff options
author | HampusM <hampus@hampusmat.com> | 2025-03-18 13:21:46 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2025-03-18 13:21:46 +0100 |
commit | 7a7d3a350b22b5555c27debff6fee4fc6100fa38 (patch) | |
tree | 9eb96f2563264f51691e2a06a7b95f8b39904d18 /ecs/src/component/storage/graph.rs | |
parent | ee7c0cb713891ae480407f56823289f3fe3b9807 (diff) |
Diffstat (limited to 'ecs/src/component/storage/graph.rs')
-rw-r--r-- | ecs/src/component/storage/graph.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ecs/src/component/storage/graph.rs b/ecs/src/component/storage/graph.rs index a8e3f17..feac16c 100644 --- a/ecs/src/component/storage/graph.rs +++ b/ecs/src/component/storage/graph.rs @@ -123,7 +123,7 @@ impl Graph if other_archetype_node .archetype() - .is_superset(&archetype_node.archetype()) + .is_superset(archetype_node.archetype()) { Self::create_missing_superset_node_edges( archetype_node, @@ -155,7 +155,7 @@ impl Graph ) { if superset_node.archetype().component_cnt() - >= target_node.archetype().component_cnt() + 1 + > target_node.archetype().component_cnt() { let first_unique_comp_id = superset_node .archetype() @@ -278,14 +278,16 @@ pub struct ArchetypeEdges pub remove: Option<ArchetypeId>, } +type ArchetypeAddEdgeDfsIterStackElem<'graph> = ( + BorrowedOrOwned<'graph, Archetype>, + VecIntoIter<(Uid, ArchetypeEdges)>, +); + #[derive(Debug)] pub struct ArchetypeAddEdgeDfsIter<'graph> { graph: &'graph Graph, - stack: Vec<( - BorrowedOrOwned<'graph, Archetype>, - VecIntoIter<(Uid, ArchetypeEdges)>, - )>, + stack: Vec<ArchetypeAddEdgeDfsIterStackElem<'graph>>, visited: HashSet<ArchetypeId>, } @@ -296,7 +298,7 @@ impl<'graph> ArchetypeAddEdgeDfsIter<'graph> Self { graph, stack: start_nodes - .into_iter() + .iter() .map(|start_node_id| { let start_node = graph .get_node_by_id(*start_node_id) @@ -313,7 +315,7 @@ impl<'graph> ArchetypeAddEdgeDfsIter<'graph> ) }) .collect(), - visited: HashSet::from_iter(start_nodes.iter().copied()), + visited: start_nodes.iter().copied().collect::<HashSet<_>>(), } } |