Crates.io | async-pipe |
lib.rs | async-pipe |
version | 0.1.3 |
source | src |
created_at | 2020-04-04 16:55:19.571514 |
updated_at | 2020-04-16 15:19:07.111403 |
description | Creates an asynchronous piped reader and writer pair using tokio.rs |
homepage | https://github.com/rousan/async-pipe-rs |
repository | https://github.com/rousan/async-pipe-rs |
max_upload_size | |
id | 226326 |
size | 25,287 |
Creates an asynchronous piped reader and writer pair using tokio.rs
.
First add this to your Cargo.toml:
[dependencies]
async-pipe = "0.1"
An example:
use async_pipe;
use tokio::prelude::*;
#[tokio::main]
async fn main() {
let (mut w, mut r) = async_pipe::pipe();
tokio::spawn(async move {
w.write_all(b"hello world").await.unwrap();
});
let mut v = Vec::new();
r.read_to_end(&mut v).await.unwrap();
println!("Received: {:?}", String::from_utf8(v));
}
Your PRs and stars are always welcome.