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
ClonableStdin |
A clonable |
ClonableStdout |
A clonable |
SendableStdin |
A sendable and clonable ThreadedStdin wrapper based on |
SendableStdinGuard |
Result of |
SendableStdout |
A sendable and clonable ThreadedStdout wrapper based on |
SendableStdoutGuard |
Result of |
ThreadedStdin |
Asynchronous stdin |
ThreadedStdout |
Asynchronous stdout |
Functions
stderr |
Constructor for the |
stdin |
Constructor for the |
stdout |
Constructor for the |
Type Definitions
ClonableStderr |
Alias for ClonableStdout to avoid confusion of ClonableStdout being used for stderr. |
SendableStderr |
Alias for SendableStdout to avoid confusion of SendableStdout being used for stderr. |
SendableStderrGuard |
Result of |
ThreadedStderr |
Asynchronous stderr |