#tokio #stdin #stdout #thread

tokio-stdin-stdout

Thread- and future::sync::mpsc-based AsyncRead/AsyncWrite stdin/stdout with little buffering

6 releases

Uses old Rust 2015

0.1.5 Oct 31, 2018
0.1.4 Aug 15, 2018
0.1.3 Jun 25, 2018
0.1.1 Oct 12, 2017

#370 in Asynchronous

Download history 190/week @ 2020-11-07 191/week @ 2020-11-14 233/week @ 2020-11-21 169/week @ 2020-11-28 213/week @ 2020-12-05 194/week @ 2020-12-12 160/week @ 2020-12-19 139/week @ 2020-12-26 211/week @ 2021-01-02 225/week @ 2021-01-09 202/week @ 2021-01-16 312/week @ 2021-01-23 205/week @ 2021-01-30 219/week @ 2021-02-06 194/week @ 2021-02-13 248/week @ 2021-02-20

680 downloads per month
Used in 7 crates (6 directly)

MIT/Apache

22KB
410 lines

tokio-stdin-stdout

AsyncRead/AsyncWrite stdin/stdout for Tokio

Documentation - more description there

Example

let mut core = tokio_core::reactor::Core::new()?;

let stdin = tokio_stdin_stdout::stdin(0);
let stdout = tokio_stdin_stdout::stdout(0);

core.run(tokio_io::io::copy(stdin, stdout))?;

Additional examples

  1. loop.rs - Write hello ten times
  2. line-by-line.rs - Convert all input text to ASCII upper case, line by line. This example also demonstrates usage of tokio-codec and various modes of starting Tokio programs (multithreaded, singlethreaded).

async fn demo

Not much related to tokio-stdin-stdout, but there are some async fn examples runnable by cargo script.

They require nightly Rust.

Alternatives

  1. tokio-stdin no AsyncRead, only stdin, byte by byte
  2. tokio-file-unix - better, but only Unix

Dependencies

~490KB