Crate tokio_pipe

Source
Expand description

Asynchronous pipe(2) library using tokio.

§Example

use tokio::io::{AsyncReadExt, AsyncWriteExt};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let (mut r, mut w) = tokio_pipe::pipe()?;

    w.write_all(b"HELLO, WORLD!").await?;

    let mut buf = [0; 16];
    let len = r.read(&mut buf[..]).await?;

    assert_eq!(&buf[..len], &b"HELLO, WORLD!"[..]);
    Ok(())
}

Structs§

AtomicWriteBuffer
A buffer that can be written atomically
AtomicWriteIoSlices
IoSlices that can be written atomically
PipeRead
Pipe read
PipeWrite
Pipe write

Constants§

PIPE_BUF

Functions§

pipe
Open pipe
splice
Moves data between pipes without copying between kernel address space and user address space.
tee
Duplicates up to len bytes of data from pipe_in to pipe_out.

Type Aliases§

off64_t