Pop all entries from the dict, returning (key, value) pairs. This is used for circular reference resolution in GC. Requires &mut self to avoid lock contention.
(&mut self)
| 812 | /// This is used for circular reference resolution in GC. |
| 813 | /// Requires &mut self to avoid lock contention. |
| 814 | pub fn drain_entries(&mut self) -> impl Iterator<Item = (PyObjectRef, T)> + '_ { |
| 815 | let inner = self.inner.get_mut(); |
| 816 | inner.used = 0; |
| 817 | inner.filled = 0; |
| 818 | inner.indices.iter_mut().for_each(|i| *i = IndexEntry::FREE); |
| 819 | inner.entries.drain(..).flatten().map(|e| (e.key, e.value)) |
| 820 | } |
| 821 | } |
| 822 | |
| 823 | type LookupResult = (IndexEntry, IndexIndex); |