Closed jplatte closed 1 year ago
I had to read the source code to find out that
UniqueIter
yields references.
I think this is because the UniqueIter
type itself is private, so its Iterator
implementation can't be viewed in the RustDoc. We should probably go ahead and make the type public.
It's also unclear what happens if new items are pushed while the iterator is alive.
Because constructing a UniqueIter
mutably borrows the slab, it has exclusive access to the slab while the iterator is alive. This means that no new items can be inserted or removed while iterating. So, new items cannot be added until the iteration is complete. This is why UniqueIter
takes &mut self
.
I've added some additional documentation in #87. Hopefully that helps!
I had to read the source code to find out that
UniqueIter
yields references. It's also unclear what happens if new items are pushed while the iterator is alive.