Crate simple_async_pipe[][src]

Expand description

Aims to provide a simple pipe-like functionality for async code.

Example

    let (mut reader, mut writer) = simple_async_pipe::pipe(64);

    let message = b"hello world";
    writer.write_all(message).await.unwrap();

    let mut buffer = vec![0u8; message.len()];
    reader.read_exact(&mut buffer).await.unwrap();
    assert_eq!(&buffer, message);

Structs

PipeRead
PipeWrite

Functions

pipe

Creates a in-memory pipe. PipeWrite will not succeed instant if the internal buffer is full.