pub fn reader_to_chan(
    thread_label: String,
    reader: impl Read + Send + 'static,
    tx: chan::Sender<u8>,
) -> JoinHandle<()> {
    let thread = move || {
        for b in reader.bytes() {
            let b = b.expect("io error");
            tx.send(b).unwrap();
        }
    };

    thread::Builder::new()
        .name(format!("{} - Reader", thread_label))
        .spawn(thread)
        .expect("failed to spawn thread")
}
/// Spawn a thread that continuously writes data from `reader` to `tx`.
Spawn a thread that continuously writes data from `reader` to `tx`.
Spawn a thread that continuously writes data from ` reader ` to ` tx ` .
pub fn reader_to_chan(
    thread_label: String,
    reader: impl Read + Send + 'static,
    tx: chan::Sender<u8>,
) -> JoinHandle<()> {
    let thread = move || {
        for b in reader.bytes() {
            let b = b.expect("io error");
            tx.send(b).unwrap();
        }
    };
    thread::Builder::new()
        .name(format!("{} - Reader", thread_label))
        .spawn(thread)
        .expect("failed to spawn thread")
}
pub fn reader_to_chan ( thread_label : String , reader : impl Read + Send + ' static , tx : chan :: Sender < u8 > , ) -> JoinHandle < ( ) > { let thread = move | | { for b in reader . bytes ( ) { let b = b . expect ( " " ) ; tx . send ( b ) . unwrap ( ) ; } } ; thread :: Builder :: new ( ) . name ( format ! ( " " thread_label ) ) . spawn ( thread ) . expect ( " " ) }
Spawn a thread that continuously writes data from `reader` to `tx`.
Spawn a thread that continuously writes data from ` reader ` to ` tx ` .
thread_label
String
reader
impl Read + Send + 'static
tx
chan::Sender<u8>
thread_label
String
reader
impl Read + Send + 'static
tx
chan::Sender<u8>