Wrap `std::io::Read` into `futures::AsyncRead`
⚓ Rust 📅 2025-12-12 👤 surdeus 👁️ 1Hello everyone, I'm trying to wrap R: Read into AsyncReader<R>: futures_io::AsyncRead.
I now recognized what a bad idea it is ...
My final code if you want to have a look (so many lines) (click for more details)There must be many bugs in my code, such as leaving some wakers never waken...
I do this since I just want to avoid tokio::fs::File, and maybe I want to try other reactors in the future.
And I just burn out to also wrap W: Write into AsyncWriter<W>: futures_io::AsyncWrite.
Maybe interacting with the OS is the correct way.
I must stop myself from wasting time, and I highly suspect that I'm in the wrong way.
I wonder:
- why my attempt is so painful? Whether it's things like
AsFdshould be used instead... - any crates can do this wrapping (for
futures_io)? - is it true that I have to implement a simple reactor to avoid losing wakers?
Thanks a loooooooooooooooot! ![]()
1 post - 1 participant
🏷️ Rust_feed