pipe

Function pipe 

Source
pub async fn pipe() -> Result<(Stream, Stream)>
Expand description

Crates a pair of connected cross-platform Stream’s.

let (mut tx, mut rx) = pipe().await.unwrap();

tx.write_all(b"hello world!\n").await.unwrap();

let mut buf = vec![0; 13];
rx.read_exact(&mut buf).await.unwrap();

assert_eq!(buf, b"hello world!\n");