orx_parallel/computations/map/
transformations.rs

1use super::m::M;
2use orx_concurrent_iter::ConcurrentIter;
3
4impl<I, O, M1> M<I, O, M1>
5where
6    I: ConcurrentIter,
7    O: Send + Sync,
8    M1: Fn(I::Item) -> O + Send + Sync,
9{
10    pub fn map<M2, Q>(self, map: M2) -> M<I, Q, impl Fn(I::Item) -> Q>
11    where
12        M2: Fn(O) -> Q + Send + Sync,
13        Q: Send + Sync,
14    {
15        let (params, iter, map1) = self.destruct();
16        let map2 = move |t| map(map1(t));
17        M::new(params, iter, map2)
18    }
19}