orx-iterable 1.3.0

Defines and implements Iterable, Collection and CollectionMut traits to represent types that can be iterated over multiple times.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::{obj_safe::IterableObj, transformations::Mapped, Iterable};
use std::boxed::Box;

impl<I, M, U> IterableObj for Mapped<I, M, U>
where
    I: Iterable,
    M: Fn(I::Item) -> U + Copy,
{
    type Item = U;

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