pub struct FnSink<T, F: FnMut(T)> { /* private fields */ }Expand description
Sink that wraps a closure.
§Example
use grafos_stream::sink::FnSink;
use grafos_stream::stage::Sink;
let mut total = 0u64;
{
let mut sink = FnSink::new(|x: u32| { total += x as u64; });
sink.accept(10).unwrap();
sink.accept(20).unwrap();
}
assert_eq!(total, 30);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T, F> Freeze for FnSink<T, F>where
F: Freeze,
impl<T, F> RefUnwindSafe for FnSink<T, F>where
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, F> Send for FnSink<T, F>
impl<T, F> Sync for FnSink<T, F>
impl<T, F> Unpin for FnSink<T, F>
impl<T, F> UnwindSafe for FnSink<T, F>where
F: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more