pub struct FnSink<F, T, E> { /* private fields */ }Expand description
Sink adapter over a closure.
§Example
use pipe_io::sink::{FnSink, Sink};
let mut total = 0u64;
{
let mut s = FnSink::new(|item: u64| -> Result<(), &'static str> {
total += item;
Ok(())
});
s.write(1).unwrap();
s.write(2).unwrap();
s.write(3).unwrap();
}
assert_eq!(total, 6);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<F, T, E> Freeze for FnSink<F, T, E>where
F: Freeze,
impl<F, T, E> RefUnwindSafe for FnSink<F, T, E>where
F: RefUnwindSafe,
impl<F, T, E> Send for FnSink<F, T, E>where
F: Send,
impl<F, T, E> Sync for FnSink<F, T, E>where
F: Sync,
impl<F, T, E> Unpin for FnSink<F, T, E>where
F: Unpin,
impl<F, T, E> UnsafeUnpin for FnSink<F, T, E>where
F: UnsafeUnpin,
impl<F, T, E> UnwindSafe for FnSink<F, T, E>where
F: 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