pub trait IteratorEnumerateBaseExt<N>: Sizedwhere
EnumerateBase<Self, N>: Iterator,{
// Provided method
fn enumerate_base(self, base: N) -> EnumerateBase<Self, N> ⓘ { ... }
}Expand description
Extend methods for all Iterator
Provided Methods§
Sourcefn enumerate_base(self, base: N) -> EnumerateBase<Self, N> ⓘ
fn enumerate_base(self, base: N) -> EnumerateBase<Self, N> ⓘ
Plus the count of Iterator::enumerate by base
Similar to self.map(|(n, elem)| (n + base, elem))
§Example
use crate::enumerate_base::IteratorEnumerateBaseExt as _;
let arr = ['a', 'b', 'c', 'd'];
let iter = arr.into_iter().enumerate().enumerate_base(2);
assert_eq!(iter.collect::<Vec<_>>(), vec![
(2, 'a'),
(3, 'b'),
(4, 'c'),
(5, 'd'),
]);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.