async fn read_stdin(tx: futures::channel::mpsc::UnboundedSender<Message>) {
        let mut stdin = tokio::io::stdin();
        loop {
            let mut buf = vec![0; 1024];
            let n = match stdin.read(&mut buf).await {
                Err(_) | Ok(0) => break,
                Ok(n) => n,
            };
            buf.truncate(n);
            tx.unbounded_send(Message::binary(buf)).unwrap();
        }
    }
// Our helper method which will read data from stdin and send it along the
// sender provided.
Our helper method which will read data from stdin and send it along the
sender provided.
Our helper method which will read data from stdin and send it along the sender provided .
async fn read_stdin(tx: futures::channel::mpsc::UnboundedSender<Message>) {
        let mut stdin = tokio::io::stdin();
        loop {
            let mut buf = vec![0; 1024];
            let n = match stdin.read(&mut buf).await {
                Err(_) | Ok(0) => break,
                Ok(n) => n,
            };
            buf.truncate(n);
            tx.unbounded_send(Message::binary(buf)).unwrap();
        }
    }
async fn read_stdin ( tx : futures :: channel :: mpsc :: UnboundedSender < Message > ) { let mut stdin = tokio :: io :: stdin ( ) ; loop { let mut buf = vec ! [ 0 1024 ] ; let n = match stdin . read ( & mut buf ) . await { Err ( _ ) | Ok ( 0 ) => break , Ok ( n ) => n , } ; buf . truncate ( n ) ; tx . unbounded_send ( Message :: binary ( buf ) ) . unwrap ( ) ; } }
Our helper method which will read data from stdin and send it along the
sender provided.
Our helper method which will read data from stdin and send it along the sender provided .
tx
futures::channel::mpsc::UnboundedSender<Message>
tx
futures::channel::mpsc::UnboundedSender<Message>