[−][src]Function nyx::write::send
ⓘImportant traits for Writer<W, F>
pub fn send<W: Write>(
writer: W,
sender: Sender<Bps>
) -> Writer<W, impl FnMut(Bps)>
Creates a writer that yields the bytes by sending it through the provided Sender
.
Examples
use std::sync::mpsc; use std::thread; use std::io; fn main() { let (sender, receiver) = mpsc::channel(); thread::spawn(move || { io::copy( &mut io::repeat(0), &mut nyx::write::send(io::sink(), sender), ) .unwrap(); }); receiver .iter() .for_each(|bps| println!("B/s from thread: {}", bps)); }