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::{obj_safe::IterableObj, sources::Repeat};
use std::boxed::Box;

impl<T> IterableObj for Repeat<T>
where
    T: Clone,
{
    type Item = T;

    fn boxed_iter(&self) -> Box<dyn Iterator<Item = Self::Item> + '_> {
        Box::new(core::iter::repeat(self.value.clone()))
    }
}

impl<T> IterableObj for core::iter::Repeat<T>
where
    T: Clone,
{
    type Item = T;

    fn boxed_iter(&self) -> Box<dyn Iterator<Item = Self::Item> + '_> {
        Box::new(self.clone())
    }
}