orx_iterable/transformations/
copied.rs

1use crate::Iterable;
2
3/// An iterable whose iterators yield elements which are copies of references
4/// that a wrapped iterable yields.
5pub struct Copied<'a, T, I>
6where
7    I: Iterable<Item = &'a T>,
8    T: Copy + 'a,
9{
10    pub(crate) it: I,
11}
12
13impl<'a, T, I> Iterable for Copied<'a, T, I>
14where
15    I: Iterable<Item = &'a T>,
16    T: Copy + 'a,
17{
18    type Item = T;
19
20    type Iter = core::iter::Copied<I::Iter>;
21
22    fn iter(&self) -> Self::Iter {
23        self.it.iter().copied()
24    }
25}