orx_parallel/infallible/fun/map/
inspect.rs1use crate::infallible::fun::Map;
2use core::marker::PhantomData;
3
4pub struct FnIns<I, F: Fn(&I) + Copy + Send>(F, PhantomData<I>);
6
7impl<I, F: Fn(&I) + Copy + Send> Clone for FnIns<I, F> {
8 fn clone(&self) -> Self {
9 *self
10 }
11}
12
13impl<I, F: Fn(&I) + Copy + Send> Copy for FnIns<I, F> {}
14
15unsafe impl<I, F: Fn(&I) + Copy + Send> Send for FnIns<I, F> {}
16
17impl<I, F: Fn(&I) + Copy + Send> FnIns<I, F> {
18 pub fn new(f: F) -> Self {
20 Self(f, PhantomData)
21 }
22}
23
24impl<I, F: Fn(&I) + Copy + Send> Map for FnIns<I, F> {
25 type I = I;
26
27 type O = I;
28
29 #[inline(always)]
30 fn map(&self, i: Self::I) -> Self::O {
31 (self.0)(&i);
32 i
33 }
34}