#[cfg(feature = "var-collections")]
use std::marker::PhantomData;
#[cfg(feature = "var-collections")]
use crate::ByteView;
use crate::const_map::ConstMap;
use crate::const_tree::ConstIter;
use crate::durability::Durability;
#[cfg(feature = "typed-tree")]
use crate::hook::TypedWriteHook;
use crate::hook::WriteHook;
use crate::key::Key;
use crate::key::Location;
use crate::map_index::{MapIter, MapKeyIter as InnerMapKeyIter};
use crate::skiplist::iter::SkipKeyKeys;
use crate::skiplist::node::ConstNode;
#[cfg(feature = "var-collections")]
use crate::skiplist::node::VarNode;
#[cfg(feature = "typed-tree")]
use crate::typed_map::TypedMap;
#[cfg(feature = "typed-tree")]
use crate::typed_tree::TypedIter;
#[cfg(feature = "var-collections")]
use crate::var_map::VarMap;
#[cfg(feature = "var-collections")]
use crate::var_tree::VarIter;
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
use crate::var_typed_tree::VarTypedDirRangeIter;
#[cfg(feature = "typed-tree")]
use crate::zero_map::ZeroMap;
#[cfg(feature = "typed-tree")]
use crate::zero_tree::ZeroIter;
#[doc(hidden)]
pub enum DirRangeIter<I> {
Forward(I),
Backward(I),
}
impl<I: DoubleEndedIterator> DirRangeIter<I> {
#[inline]
pub(crate) fn from_storage_match(iter: I, with_storage: bool) -> Self {
if with_storage {
Self::Forward(iter)
} else {
Self::Backward(iter)
}
}
}
impl<I: DoubleEndedIterator> Iterator for DirRangeIter<I> {
type Item = I::Item;
fn next(&mut self) -> Option<Self::Item> {
match self {
Self::Forward(iter) => iter.next(),
Self::Backward(iter) => iter.next_back(),
}
}
}
#[cfg(feature = "typed-tree")]
pub struct TreeRowIter<'a, K: Key, T: Send + Sync> {
inner: DirRangeIter<TypedIter<'a, K, T>>,
}
#[cfg(feature = "typed-tree")]
impl<'a, K: Key, T: Send + Sync> TreeRowIter<'a, K, T> {
pub(crate) fn new(inner: DirRangeIter<TypedIter<'a, K, T>>) -> Self {
Self { inner }
}
pub fn for_each_ref(self, f: impl FnMut(K, &T) -> std::ops::ControlFlow<()>) {
match self.inner {
DirRangeIter::Forward(iter) => iter.for_each_ref(f),
DirRangeIter::Backward(iter) => iter.for_each_ref_back(f),
}
}
}
#[cfg(feature = "typed-tree")]
impl<'a, K: Key, T: Send + Sync> Iterator for TreeRowIter<'a, K, T> {
type Item = (K, crate::typed_tree::TypedRef<'a, T>);
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(feature = "typed-tree")]
pub struct TreeKeyIter<'a, K: Key, T: Send + Sync> {
inner: SkipKeyKeys<'a, K, crate::skiplist::node::TypedNode<K, T>>,
}
#[cfg(feature = "typed-tree")]
impl<'a, K: Key, T: Send + Sync> TreeKeyIter<'a, K, T> {
pub(crate) fn new(inner: SkipKeyKeys<'a, K, crate::skiplist::node::TypedNode<K, T>>) -> Self {
Self { inner }
}
}
#[cfg(feature = "typed-tree")]
impl<K: Key, T: Send + Sync> Iterator for TreeKeyIter<'_, K, T> {
type Item = K;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
pub struct ConstTreeRowIter<'a, K: Key, const V: usize, L: Location> {
inner: DirRangeIter<ConstIter<'a, K, V, L>>,
}
impl<'a, K: Key, const V: usize, L: Location> ConstTreeRowIter<'a, K, V, L> {
pub(crate) fn new(inner: DirRangeIter<ConstIter<'a, K, V, L>>) -> Self {
Self { inner }
}
}
impl<K: Key, const V: usize, L: Location> Iterator for ConstTreeRowIter<'_, K, V, L> {
type Item = (K, [u8; V]);
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
pub struct ConstTreeKeyIter<'a, K: Key, const V: usize, L: Location> {
inner: SkipKeyKeys<'a, K, ConstNode<K, V, L>>,
}
impl<'a, K: Key, const V: usize, L: Location> ConstTreeKeyIter<'a, K, V, L> {
pub(crate) fn new(inner: SkipKeyKeys<'a, K, ConstNode<K, V, L>>) -> Self {
Self { inner }
}
}
impl<K: Key, const V: usize, L: Location> Iterator for ConstTreeKeyIter<'_, K, V, L> {
type Item = K;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(feature = "typed-tree")]
pub struct ZeroTreeRowIter<
'a,
K: Key,
const V: usize,
T: Copy + zerocopy::IntoBytes + zerocopy::FromBytes + zerocopy::Immutable,
L: Location = crate::disk_loc::DiskLoc,
> {
inner: DirRangeIter<ZeroIter<'a, K, V, T, L>>,
}
#[cfg(feature = "typed-tree")]
impl<'a, K: Key, const V: usize, T, L: Location> ZeroTreeRowIter<'a, K, V, T, L>
where
T: Copy + zerocopy::IntoBytes + zerocopy::FromBytes + zerocopy::Immutable,
{
pub(crate) fn new(inner: DirRangeIter<ZeroIter<'a, K, V, T, L>>) -> Self {
Self { inner }
}
}
#[cfg(feature = "typed-tree")]
impl<K: Key, const V: usize, T, L: Location> Iterator for ZeroTreeRowIter<'_, K, V, T, L>
where
T: Copy + zerocopy::IntoBytes + zerocopy::FromBytes + zerocopy::Immutable,
{
type Item = (K, T);
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(feature = "typed-tree")]
pub struct ZeroTreeKeyIter<'a, K: Key, const V: usize, L: Location> {
inner: ConstTreeKeyIter<'a, K, V, L>,
}
#[cfg(feature = "typed-tree")]
impl<'a, K: Key, const V: usize, L: Location> ZeroTreeKeyIter<'a, K, V, L> {
pub(crate) fn new(inner: SkipKeyKeys<'a, K, ConstNode<K, V, L>>) -> Self {
Self {
inner: ConstTreeKeyIter::new(inner),
}
}
}
#[cfg(feature = "typed-tree")]
impl<K: Key, const V: usize, L: Location> Iterator for ZeroTreeKeyIter<'_, K, V, L> {
type Item = K;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(feature = "var-collections")]
pub struct VarTreeRowIter<'a, K: Key, H: WriteHook<K>> {
inner: DirRangeIter<VarIter<'a, K, H>>,
}
#[cfg(feature = "var-collections")]
impl<'a, K: Key, H: WriteHook<K>> VarTreeRowIter<'a, K, H> {
pub(crate) fn new(inner: DirRangeIter<VarIter<'a, K, H>>) -> Self {
Self { inner }
}
}
#[cfg(feature = "var-collections")]
impl<K: Key, H: WriteHook<K>> Iterator for VarTreeRowIter<'_, K, H> {
type Item = (K, ByteView);
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(feature = "var-collections")]
pub struct VarTreeKeyIter<'a, K: Key, H: WriteHook<K>> {
inner: SkipKeyKeys<'a, K, VarNode<K>>,
_marker: PhantomData<H>,
}
#[cfg(feature = "var-collections")]
impl<'a, K: Key, H: WriteHook<K>> VarTreeKeyIter<'a, K, H> {
pub(crate) fn new(inner: SkipKeyKeys<'a, K, VarNode<K>>) -> Self {
Self {
inner,
_marker: PhantomData,
}
}
}
#[cfg(feature = "var-collections")]
impl<K: Key, H: WriteHook<K>> Iterator for VarTreeKeyIter<'_, K, H> {
type Item = K;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
pub struct VarTypedTreeRowIter<
'a,
K: Key,
T: Send + Sync,
C: crate::codec::Codec<T> + Clone,
H: TypedWriteHook<K, T>,
> {
inner: VarTypedDirRangeIter<'a, K, T, C, H>,
}
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
impl<'a, K, T, C, H> VarTypedTreeRowIter<'a, K, T, C, H>
where
K: Key,
T: Send + Sync,
C: crate::codec::Codec<T> + Clone,
H: TypedWriteHook<K, T>,
{
pub(crate) fn new(inner: VarTypedDirRangeIter<'a, K, T, C, H>) -> Self {
Self { inner }
}
}
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
impl<K, T, C, H> Iterator for VarTypedTreeRowIter<'_, K, T, C, H>
where
K: Key,
T: Send + Sync,
C: crate::codec::Codec<T> + Clone,
H: TypedWriteHook<K, T>,
{
type Item = (K, T);
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
pub struct VarTypedTreeKeyIter<
'a,
K: Key,
T: Send + Sync,
C: crate::codec::Codec<T> + Clone,
H: TypedWriteHook<K, T>,
> {
inner: VarTreeKeyIter<'a, K, crate::hook::VarTypedHookAdapter<K, T, C, H>>,
}
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
impl<'a, K, T, C, H> VarTypedTreeKeyIter<'a, K, T, C, H>
where
K: Key,
T: Send + Sync,
C: crate::codec::Codec<T> + Clone,
H: TypedWriteHook<K, T>,
{
pub(crate) fn new(inner: SkipKeyKeys<'a, K, VarNode<K>>) -> Self {
Self {
inner: VarTreeKeyIter::new(inner),
}
}
}
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
impl<K, T, C, H> Iterator for VarTypedTreeKeyIter<'_, K, T, C, H>
where
K: Key,
T: Send + Sync,
C: crate::codec::Codec<T> + Clone,
H: TypedWriteHook<K, T>,
{
type Item = K;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
pub struct ConstMapRowIter<
'a,
K: Key + Send + Sync + std::hash::Hash + Eq,
const V: usize,
H: WriteHook<K>,
D: Durability,
> {
inner: MapIter<'a, ConstMap<K, V, H, D>>,
}
impl<'a, K, const V: usize, H, D> ConstMapRowIter<'a, K, V, H, D>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
H: WriteHook<K>,
D: Durability,
{
pub(crate) fn new(inner: MapIter<'a, ConstMap<K, V, H, D>>) -> Self {
Self { inner }
}
}
impl<K, const V: usize, H, D> Iterator for ConstMapRowIter<'_, K, V, H, D>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
H: WriteHook<K>,
D: Durability,
{
type Item = (K, [u8; V]);
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
pub struct ConstMapKeyIter<
'a,
K: Key + Send + Sync + std::hash::Hash + Eq,
const V: usize,
H: WriteHook<K>,
D: Durability,
> {
inner: InnerMapKeyIter<'a, ConstMap<K, V, H, D>>,
}
impl<'a, K, const V: usize, H, D> ConstMapKeyIter<'a, K, V, H, D>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
H: WriteHook<K>,
D: Durability,
{
pub(crate) fn new(inner: InnerMapKeyIter<'a, ConstMap<K, V, H, D>>) -> Self {
Self { inner }
}
}
impl<K, const V: usize, H, D> Iterator for ConstMapKeyIter<'_, K, V, H, D>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
H: WriteHook<K>,
D: Durability,
{
type Item = K;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(feature = "typed-tree")]
pub struct ZeroMapRowIter<
'a,
K: Key + Send + Sync + std::hash::Hash + Eq,
const V: usize,
T: Copy + zerocopy::IntoBytes + zerocopy::FromBytes + zerocopy::Immutable,
H: TypedWriteHook<K, T>,
D: Durability,
> {
inner: MapIter<'a, ZeroMap<K, V, T, H, D>>,
}
#[cfg(feature = "typed-tree")]
impl<'a, K, const V: usize, T, H, D> ZeroMapRowIter<'a, K, V, T, H, D>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Copy + zerocopy::IntoBytes + zerocopy::FromBytes + zerocopy::Immutable,
H: TypedWriteHook<K, T>,
D: Durability,
{
pub(crate) fn new(inner: MapIter<'a, ZeroMap<K, V, T, H, D>>) -> Self {
Self { inner }
}
}
#[cfg(feature = "typed-tree")]
impl<K, const V: usize, T, H, D> Iterator for ZeroMapRowIter<'_, K, V, T, H, D>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Copy + zerocopy::IntoBytes + zerocopy::FromBytes + zerocopy::Immutable,
H: TypedWriteHook<K, T>,
D: Durability,
{
type Item = (K, T);
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(feature = "typed-tree")]
pub struct ZeroMapKeyIter<
'a,
K: Key + Send + Sync + std::hash::Hash + Eq,
const V: usize,
T: Copy + zerocopy::IntoBytes + zerocopy::FromBytes + zerocopy::Immutable,
H: TypedWriteHook<K, T>,
D: Durability,
> {
inner: InnerMapKeyIter<'a, ZeroMap<K, V, T, H, D>>,
}
#[cfg(feature = "typed-tree")]
impl<'a, K, const V: usize, T, H, D> ZeroMapKeyIter<'a, K, V, T, H, D>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Copy + zerocopy::IntoBytes + zerocopy::FromBytes + zerocopy::Immutable,
H: TypedWriteHook<K, T>,
D: Durability,
{
pub(crate) fn new(inner: InnerMapKeyIter<'a, ZeroMap<K, V, T, H, D>>) -> Self {
Self { inner }
}
}
#[cfg(feature = "typed-tree")]
impl<K, const V: usize, T, H, D> Iterator for ZeroMapKeyIter<'_, K, V, T, H, D>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Copy + zerocopy::IntoBytes + zerocopy::FromBytes + zerocopy::Immutable,
H: TypedWriteHook<K, T>,
D: Durability,
{
type Item = K;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(feature = "var-collections")]
pub struct VarMapRowIter<'a, K: Key + Send + Sync + std::hash::Hash + Eq, H: WriteHook<K>> {
inner: MapIter<'a, VarMap<K, H>>,
}
#[cfg(feature = "var-collections")]
impl<'a, K, H> VarMapRowIter<'a, K, H>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
H: WriteHook<K>,
{
pub(crate) fn new(inner: MapIter<'a, VarMap<K, H>>) -> Self {
Self { inner }
}
}
#[cfg(feature = "var-collections")]
impl<K, H> Iterator for VarMapRowIter<'_, K, H>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
H: WriteHook<K>,
{
type Item = (K, ByteView);
fn next(&mut self) -> Option<Self::Item> {
self.inner.next().map(|(k, entry)| (k, entry.value))
}
}
#[cfg(feature = "var-collections")]
pub struct VarMapKeyIter<'a, K: Key + Send + Sync + std::hash::Hash + Eq, H: WriteHook<K>> {
inner: InnerMapKeyIter<'a, VarMap<K, H>>,
}
#[cfg(feature = "var-collections")]
impl<'a, K, H> VarMapKeyIter<'a, K, H>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
H: WriteHook<K>,
{
pub(crate) fn new(inner: InnerMapKeyIter<'a, VarMap<K, H>>) -> Self {
Self { inner }
}
}
#[cfg(feature = "var-collections")]
impl<K, H> Iterator for VarMapKeyIter<'_, K, H>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
H: WriteHook<K>,
{
type Item = K;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
pub struct VarTypedMapRowIter<
'a,
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Send + Sync,
C: crate::codec::Codec<T> + Clone + Sync,
H: TypedWriteHook<K, T>,
> {
codec: &'a C,
inner: MapIter<'a, VarMap<K, crate::hook::VarTypedHookAdapter<K, T, C, H>>>,
}
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
impl<'a, K, T, C, H> VarTypedMapRowIter<'a, K, T, C, H>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Send + Sync,
C: crate::codec::Codec<T> + Clone + Sync,
H: TypedWriteHook<K, T>,
{
pub(crate) fn new(
codec: &'a C,
inner: MapIter<'a, VarMap<K, crate::hook::VarTypedHookAdapter<K, T, C, H>>>,
) -> Self {
Self { codec, inner }
}
}
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
impl<K, T, C, H> Iterator for VarTypedMapRowIter<'_, K, T, C, H>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Send + Sync,
C: crate::codec::Codec<T> + Clone + Sync,
H: TypedWriteHook<K, T>,
{
type Item = (K, T);
fn next(&mut self) -> Option<Self::Item> {
loop {
let (k, entry) = self.inner.next()?;
match self.codec.decode_from(&entry.value) {
Ok(v) => return Some((k, v)),
Err(_) => {
tracing::warn!(
value_len = entry.value.len(),
"var_typed_map scope iter: decode error, skipping entry"
);
}
}
}
}
}
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
pub struct VarTypedMapKeyIter<
'a,
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Send + Sync,
C: crate::codec::Codec<T> + Clone + Sync,
H: TypedWriteHook<K, T>,
> {
inner: InnerMapKeyIter<'a, VarMap<K, crate::hook::VarTypedHookAdapter<K, T, C, H>>>,
}
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
impl<'a, K, T, C, H> VarTypedMapKeyIter<'a, K, T, C, H>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Send + Sync,
C: crate::codec::Codec<T> + Clone + Sync,
H: TypedWriteHook<K, T>,
{
pub(crate) fn new(
inner: InnerMapKeyIter<'a, VarMap<K, crate::hook::VarTypedHookAdapter<K, T, C, H>>>,
) -> Self {
Self { inner }
}
}
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
impl<K, T, C, H> Iterator for VarTypedMapKeyIter<'_, K, T, C, H>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Send + Sync,
C: crate::codec::Codec<T> + Clone + Sync,
H: TypedWriteHook<K, T>,
{
type Item = K;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(feature = "typed-tree")]
pub struct MapRowIter<
'a,
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Send + Sync,
C: crate::codec::Codec<T> + Sync,
H: TypedWriteHook<K, T>,
> {
map: &'a TypedMap<K, T, C, H>,
inner: MapIter<'a, TypedMap<K, T, C, H>>,
_guard: seize::LocalGuard<'a>,
}
#[cfg(feature = "typed-tree")]
impl<'a, K, T, C, H> MapRowIter<'a, K, T, C, H>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Send + Sync,
C: crate::codec::Codec<T> + Sync,
H: TypedWriteHook<K, T>,
{
pub(crate) fn new(
map: &'a TypedMap<K, T, C, H>,
inner: MapIter<'a, TypedMap<K, T, C, H>>,
) -> Self {
let _guard = map.inspection_guard();
Self { map, inner, _guard }
}
}
#[cfg(feature = "typed-tree")]
impl<'a, K, T, C, H> Iterator for MapRowIter<'a, K, T, C, H>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Send + Sync,
C: crate::codec::Codec<T> + Sync,
H: TypedWriteHook<K, T>,
{
type Item = (K, crate::typed_tree::TypedRef<'a, T>);
fn next(&mut self) -> Option<Self::Item> {
let (k, ptr) = self.inner.next()?;
let guard = self.map.inspection_guard();
Some((k, crate::typed_tree::TypedRef::new(guard, ptr)))
}
}
#[cfg(feature = "typed-tree")]
pub struct MapKeyIter<
'a,
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Send + Sync,
C: crate::codec::Codec<T> + Sync,
H: TypedWriteHook<K, T>,
> {
inner: InnerMapKeyIter<'a, TypedMap<K, T, C, H>>,
}
#[cfg(feature = "typed-tree")]
impl<'a, K, T, C, H> MapKeyIter<'a, K, T, C, H>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Send + Sync,
C: crate::codec::Codec<T> + Sync,
H: TypedWriteHook<K, T>,
{
pub(crate) fn new(inner: InnerMapKeyIter<'a, TypedMap<K, T, C, H>>) -> Self {
Self { inner }
}
}
#[cfg(feature = "typed-tree")]
impl<K, T, C, H> Iterator for MapKeyIter<'_, K, T, C, H>
where
K: Key + Send + Sync + std::hash::Hash + Eq,
T: Send + Sync,
C: crate::codec::Codec<T> + Sync,
H: TypedWriteHook<K, T>,
{
type Item = K;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(feature = "fjall")]
pub struct LsmRowIter<'a, K, T, C> {
inner: crate::lsm::LsmIter<'a, K, T, C>,
}
#[cfg(feature = "fjall")]
impl<'a, K, T, C> LsmRowIter<'a, K, T, C> {
pub(crate) fn new(inner: crate::lsm::LsmIter<'a, K, T, C>) -> Self {
Self { inner }
}
}
#[cfg(feature = "fjall")]
impl<K: Key, T, C: crate::codec::Codec<T>> Iterator for LsmRowIter<'_, K, T, C> {
type Item = (K, T);
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}
#[cfg(feature = "fjall")]
pub struct LsmKeyIter<K> {
inner: crate::lsm::LsmKeyIter<K>,
}
#[cfg(feature = "fjall")]
impl<K> LsmKeyIter<K> {
pub(crate) fn new(inner: crate::lsm::LsmKeyIter<K>) -> Self {
Self { inner }
}
}
#[cfg(feature = "fjall")]
impl<K: Key> Iterator for LsmKeyIter<K> {
type Item = K;
fn next(&mut self) -> Option<Self::Item> {
self.inner.next()
}
}