micro_moka/unsync/
iter.rs1use super::SlabEntry;
2
3pub struct Iter<'i, K, V> {
4 inner: std::slice::Iter<'i, Option<SlabEntry<K, V>>>,
5}
6
7impl<'i, K, V> Iter<'i, K, V> {
8 pub(crate) fn new(entries: &'i [Option<SlabEntry<K, V>>]) -> Self {
9 Self {
10 inner: entries.iter(),
11 }
12 }
13}
14
15impl<'i, K, V> Iterator for Iter<'i, K, V> {
16 type Item = (&'i K, &'i V);
17
18 fn next(&mut self) -> Option<Self::Item> {
19 loop {
20 match self.inner.next() {
21 Some(Some(entry)) => return Some((&entry.key, &entry.value)),
22 Some(None) => continue,
23 None => return None,
24 }
25 }
26 }
27}