Crate tokio_stdin_stdout[][src]

A bridge between [std::io::std{in,out}][1] and Future's AsyncRead/AsyncWrite worlds. [1]:https://doc.rust-lang.org/std/io/fn.stdin.html

Example:

extern crate tokio_core;
extern crate tokio_io;
extern crate tokio_stdin_stdout;

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

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

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

It works by starting separate threads, which do actual synchronous I/O and communicating to the asynchronous world using future::sync::mpsc.

For Unix (Linux, OS X) better use tokio-file-unix.

Concerns:

  • stdin/stdout are not expected to be ever normally used after using functions from this crate
  • Allocation-heavy.
  • All errors collapsed to ErrorKind::Other (for stdout) or ErrorKind::BrokenPipe (for stdin)
  • Failure to write to stdout is only seen after attempting to send there about 3 more buffers.

Structs

ThreadedStdin

Asynchronous stdin

ThreadedStdout

Asynchronous stdout

Functions

stderr

Constructor for the ThreadedStderr

stdin

Constructor for the ThreadedStdin

stdout

Constructor for the ThreadedStdout

Type Definitions

ThreadedStderr

Asynchronous stderr