diff --git a/miniconf/src/iter.rs b/miniconf/src/iter.rs index 6530c842..f3509385 100644 --- a/miniconf/src/iter.rs +++ b/miniconf/src/iter.rs @@ -29,6 +29,14 @@ impl Iterator for ExactSize { } } +impl ExactSize { + /// Return a reference to the inner iterator + #[inline] + pub fn inner(&self) -> &T { + &self.iter + } +} + // Even though general TreeKey iterations may well be longer than usize::MAX // we are sure that the aren't in this case since self.count <= usize::MAX impl ExactSizeIterator for ExactSize {} @@ -52,6 +60,7 @@ impl Keys for Consume { Ok(()) } } + impl IntoKeys for Consume { type IntoKeys = Self; @@ -127,6 +136,16 @@ impl NodeIter { count: meta.count, } } + + /// Return the current iteration depth + pub fn current_depth(&self) -> usize { + self.depth + } + + /// Return the root depth + pub fn root_depth(&self) -> usize { + self.root + } } impl Iterator for NodeIter @@ -173,7 +192,7 @@ where } } -// Do not allow manipulation of `depth` other than through iteration. +// Contract: Do not allow manipulation of `depth` other than through iteration. impl core::iter::FusedIterator for NodeIter {