Function compio_fs::pipe::anonymous

source ยท
pub fn anonymous() -> Result<(Receiver, Sender)>
Available on Unix only.
Expand description

Creates a pair of anonymous pipe.

use compio_fs::pipe::anonymous;
use compio_io::{AsyncReadExt, AsyncWriteExt};

let (mut rx, mut tx) = anonymous().unwrap();

tx.write_all("Hello world!").await.unwrap();
let (_, buf) = rx.read_exact(Vec::with_capacity(12)).await.unwrap();
assert_eq!(&buf, b"Hello world!");