1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::marker::PhantomData;

use super::Pusherator;

pub struct ForEach<Func, In> {
    func: Func,
    _marker: PhantomData<fn(In)>,
}
impl<Func, In> Pusherator for ForEach<Func, In>
where
    Func: FnMut(In),
{
    type Item = In;
    fn give(&mut self, item: Self::Item) {
        (self.func)(item)
    }
}
impl<Func, In> ForEach<Func, In>
where
    Func: FnMut(In),
{
    pub fn new(func: Func) -> Self {
        Self {
            func,
            _marker: PhantomData,
        }
    }
}