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
A buffer that can be written atomically
IoSlice
s that can be written atomically
Pipe read
Pipe write
Constants
Functions
Open pipe