We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent efaf4e0 commit 6b3d1e9Copy full SHA for 6b3d1e9
core/src/iter/adapters/enumerate.rs
@@ -23,6 +23,18 @@ impl<I> Enumerate<I> {
23
pub(in crate::iter) fn new(iter: I) -> Enumerate<I> {
24
Enumerate { iter, count: 0 }
25
}
26
+
27
+ /// Retrieve the current position of the iterator.
28
+ ///
29
+ /// If the iterator has not advanced, the position returned will be 0.
30
31
+ /// The position may also exceed the bounds of the iterator to allow for calculating
32
+ /// the displacement of the iterator from following calls to [`Iterator::next`].
33
+ #[inline]
34
+ #[unstable(feature = "next_index", issue = "130711")]
35
+ pub fn next_index(&self) -> usize {
36
+ self.count
37
+ }
38
39
40
#[stable(feature = "rust1", since = "1.0.0")]
0 commit comments