Crate async_pipe

Source
Expand description

Creates an asynchronous piped reader and writer pair using tokio.rs.

§Examples

use async_pipe;
use tokio::prelude::*;

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));

tokio::runtime::Runtime::new().unwrap().block_on(run());

Structs§

PipeReader
The read half of the pipe which implements AsyncRead.
PipeWriter
The write half of the pipe which implements AsyncWrite.

Functions§

pipe
Creates a piped pair of an AsyncWrite and an AsyncRead.