tokio-pipe

Crates.iotokio-pipe
lib.rstokio-pipe
version0.2.12
sourcesrc
created_at2020-06-21 06:58:40.899528
updated_at2022-06-26 15:00:08.643118
descriptionAsynchronous pipe(2) library using tokio.
homepage
repositoryhttps://github.com/yskszk63/tokio-pipe
max_upload_size
id256233
size49,035
yusuke suzuki (yskszk63)

documentation

README

tokio-pipe

tokio-pipe dependency status

Asynchronous pipe(2) library using tokio.

Example

use tokio::prelude::*;

#[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(())
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 172

cargo fmt