[][src]Crate duplexify

Combine a reader + writer into a duplex of Read + Write.

This is useful when you need a reader + writer, but it doesn't come neatly pre-packaged. This allows wiring it together with minimal effort. See also: io::empty, io::sink.

Examples

Read a line from stdin, and write it to stdout. All from the same stdio object:

use async_std::io::{self, BufReader, prelude::*};
use duplexify::Duplex;

let stdin = BufReader::new(io::stdin());
let stdout = io::stdout();
let mut stdio = Duplex::new(stdin, stdout);

let mut line = String::new();
stdio.read_line(&mut line).await?;
stdio.write_all(&line.as_bytes()).await?;

Structs

Duplex

Combine a reader + writer into a duplex of Read + Write.