orx-iterable 1.3.0

Defines and implements Iterable, Collection and CollectionMut traits to represent types that can be iterated over multiple times.
Documentation
use crate::Iterable;

/// Wraps an `Iterable` and creates a new `Iterable` which yields the element indices
/// together with the elements.
pub struct Enumerated<I>
where
    I: Iterable,
{
    pub(crate) it: I,
}

impl<I> Iterable for Enumerated<I>
where
    I: Iterable,
{
    type Item = (usize, I::Item);

    type Iter = core::iter::Enumerate<I::Iter>;

    fn iter(&self) -> Self::Iter {
        self.it.iter().enumerate()
    }
}