EnumerateBaseExt

Trait EnumerateBaseExt 

Source
pub trait EnumerateBaseExt: Sized {
    // Required method
    fn base(self, base: usize) -> EnumerateBase<Self, usize> ;
}
Expand description

Extend methods for all iter::Enumerate

Required Methods§

Source

fn base(self, base: usize) -> EnumerateBase<Self, usize>

Plus the count of Iterator::enumerate by base

Similar to self.map(|(n, elem)| (n + base, elem))

§Example
use crate::enumerate_base::EnumerateBaseExt as _;
let arr = ['a', 'b', 'c', 'd'];
let iter = arr.into_iter().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.

Implementations on Foreign Types§

Source§

impl<I: Iterator> EnumerateBaseExt for Enumerate<I>

Source§

fn base(self, base: usize) -> EnumerateBase<Self, usize>

Implementors§