2 releases
0.1.1 | Jun 24, 2021 |
---|---|
0.1.0 | Jun 14, 2021 |
#976 in Asynchronous
8KB
142 lines
simple-async-pipe
Aims to provide a simple pipe-like functionality for async code. Created to be used in tests. No performance optimization done.
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
lib.rs
:
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);
Dependencies
~2–3MB
~46K SLoC