In my project I have a helper struct defined as
pub struct EntityIter<T: EntityRef + ReservedValue> {
i: usize,
entities: EntityList<T>,
}
impl<T: EntityRef + ReservedValue> EntityIter<T> {
pub fn next(&mut self, pool: &ListPool<T>) -> Option<T> {
let v = self.entities.get(self.i, pool);
self.i += 1;
v
}
}
For cases where I want to iterate an EntityList without borrowing its corresponding ListPool for the full duration.
while let Some(v) = iter.next(var_pool) {...}
Would there be an interest in me fleshing it out a bit and then merging it into upstream cranelift-entity?
I'm unsure how much you guys are looking to keep cranelift-entity specific to the requirements of just Cranelift.
Last updated: Jul 29 2026 at 05:03 UTC