[−][src]Function nyx::read::send
ⓘImportant traits for Reader<R, F>
pub fn send<R: Read>(
reader: R,
sender: Sender<Bps>
) -> Reader<R, impl FnMut(Bps)>
Creates a reader 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 nyx::read::send(io::repeat(0), sender), &mut io::sink(), ) .unwrap(); }); receiver .iter() .for_each(|bps| println!("B/s from thread: {}", bps)); }