We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd4a196 commit c78b76bCopy full SHA for c78b76b
crates/bevy_ecs/src/query/iter.rs
@@ -123,6 +123,20 @@ where
123
}
124
125
126
+
127
+ // NOTE: For unfiltered Queries this should actually return a exact size hint,
128
+ // to fulfil the ExactSizeIterator invariant, but this isn't practical without specialization.
129
+ // For more information see Issue #1686.
130
+ fn size_hint(&self) -> (usize, Option<usize>) {
131
+ let max_size = self
132
+ .query_state
133
+ .matched_archetypes
134
+ .ones()
135
+ .map(|index| self.world.archetypes[ArchetypeId::new(index)].len())
136
+ .sum();
137
138
+ (0, Some(max_size))
139
+ }
140
141
142
// NOTE: We can cheaply implement this for unfiltered Queries because we have:
0 commit comments