pub fn pipe() -> (Writer, Reader)Expand description
Creates a pair of synchronous writer and reader objects.
This function returns a tuple containing a Writer and a Reader.
The Writer can be used to write data, which can then be read from the Reader.
§Returns
A tuple containing (Writer, Reader).
§Example
use std::io::{read_to_string, Write};
use io_pipe::pipe;
let (mut writer, reader) = pipe();
writer.write_all("hello".as_bytes()).unwrap();
drop(writer);
assert_eq!("hello".to_string(), read_to_string(reader).unwrap());