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§
- Pipe
BufWriter - The
Writeend of a pipe (seepipe()) that will buffer small writes before sending to the reader end. - Pipe
Reader - The
Readend of a pipe (seepipe()) - Pipe
Writer - The
Writeend of a pipe (seepipe())
Functions§
- bipipe
bidirectional - Creates a pair of pipes for bidirectional communication, a bit like UNIX’s
socketpair(2). - bipipe_
buffered bidirectional - 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