-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async versions for Reader and Writer #136
Comments
I've tried to add it, but quickly realized that it requires [mostly] duplicate versions for too many of internal functions. Like for
it needs an accompanying:
and so on. It's definitely possible to implement, but the main question if that aligns well with |
Duplicating the code is no go. IMO a more feasible way is to make everything async and use a same-thread thread pool for sync usage. But I haven't seen any other library doing it so probably I miss something. |
For this particular example it's possible to move out the duplicate part into an inline function, and keep only Or actually I think that many functions like this one could be transformed to something more universal which could work in both ways. I'm worried mostly about the fact that too many things must be touched to support async. |
Regarding the sync usage, there is https://docs.rs/tokio-util/0.7.4/tokio_util/io/struct.SyncIoBridge.html that allows it |
I'm wondering if there are any plans (or opposition to those) for async implementation for Reader and Writer? I.e., a reader from
tokio::io::AsyncRead
, etcThe text was updated successfully, but these errors were encountered: