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;

/// An iterable whose iterators yield elements which are clones of references
/// that a wrapped iterable yields.
pub struct Cloned<'a, T, I>
where
    I: Iterable<Item = &'a T>,
    T: Clone + 'a,
{
    pub(crate) it: I,
}

impl<'a, T, I> Iterable for Cloned<'a, T, I>
where
    I: Iterable<Item = &'a T>,
    T: Clone + 'a,
{
    type Item = T;

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

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