tokio-io-compat

GitHub Workflow Status crates.io Documentation

Compatibility wrapper around std::io::{Read, Write, Seek} traits that implements tokio::io::{AsyncRead, AsyncWrite, AsyncSeek}.

Beware that this won't magically make your IO operations asynchronous. You should still consider asyncify your code or move the IO operations to blocking thread if the cost is high.

Example

```rust use std::io::Cursor; use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekFrom}; use tokioiocompat::CompatHelperTrait;

let mut data = Cursor::new(vec![]); data.tokioiomut().writeall(&vec![0, 1, 2, 3, 4]).await.unwrap(); data.tokioiomut().seek(SeekFrom::Start(2)).await.unwrap(); asserteq!(data.tokioiomut().read_u8().await.unwrap(), 2); ```