Skip to main content

Module pipe

Module pipe 

Source
Expand description

Unix pipes: an anonymous pair (pipe) and FIFOs opened by path (OpenOptions), as a Sender (the write end) and a Receiver (the read end). Each is a Handle of std’s pipe end, read or written by the driver as any byte stream, with the calls of its one direction.

use nuclei::io::{AsyncReadExt, AsyncWriteExt};
use nuclei::net::unix::pipe;

let (mut tx, mut rx) = pipe::pipe()?;
tx.write_all(b"through").await?;
tx.flush().await?;
let mut buf = [0u8; 7];
rx.read_exact(&mut buf).await?;
assert_eq!(&buf, b"through");

Structs§

OpenOptions
How a FIFO is opened by path.

Functions§

pipe
A new anonymous pipe: what is written to the sender is read from the receiver.

Type Aliases§

Receiver
A pipe’s read end.
Sender
A pipe’s write end.