Crates.io | tokio-pipe |
lib.rs | tokio-pipe |
version | 0.2.12 |
source | src |
created_at | 2020-06-21 06:58:40.899528 |
updated_at | 2022-06-26 15:00:08.643118 |
description | Asynchronous pipe(2) library using tokio. |
homepage | |
repository | https://github.com/yskszk63/tokio-pipe |
max_upload_size | |
id | 256233 |
size | 49,035 |
Asynchronous pipe(2) library using tokio.
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(())
}
Licensed under either of
at your option.
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.