Crate pipe

Source
Expand description

Synchronous in-memory pipe

§Example

use std::thread::spawn;
use std::io::{Read, Write};

let (mut read, mut write) = pipe::pipe();

let message = "Hello, world!";
spawn(move || write.write_all(message.as_bytes()).unwrap());

let mut s = String::new();
read.read_to_string(&mut s).unwrap();

assert_eq!(&s, message);

Structs§

PipeBufWriter
The Write end of a pipe (see pipe()) that will buffer small writes before sending to the reader end.
PipeReader
The Read end of a pipe (see pipe())
PipeWriter
The Write end of a pipe (see pipe())

Functions§

bipipebidirectional
Creates a pair of pipes for bidirectional communication, a bit like UNIX’s socketpair(2).
bipipe_bufferedbidirectional
Creates a pair of pipes for bidirectional communication using buffered writer, a bit like UNIX’s socketpair(2).
pipe
Creates a synchronous memory pipe
pipe_buffered
Creates a synchronous memory pipe with buffered writer