Skip to content
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

Wrapping std::io::{Read, Write} #22

Closed
dignifiedquire opened this issue Apr 24, 2020 · 5 comments
Closed

Wrapping std::io::{Read, Write} #22

dignifiedquire opened this issue Apr 24, 2020 · 5 comments

Comments

@dignifiedquire
Copy link
Contributor

Currently Async supports wrapping things that can be converted pollable resources. In async-native-tls there is an adapter transforming a resource taht is only std::io{Read|Write} into AsyncRead|Write.

I wonder if this could be improved on, cleaned up and possibly put into here, allowing resources that are not pollable, to be wrapped easily.

Ref: https://github.com/async-email/async-native-tls/blob/master/src/std_adapter.rs

@ghost
Copy link

ghost commented Apr 24, 2020

Hmm, I think I'd like to see at least one other use case of this adapter to consider it worth including :)

This also seems like something that could be put into some kind of async utils crate, which piper is slowly growing into... It's not like this is directly related to the runtime, after all.

@dignifiedquire
Copy link
Contributor Author

Hmm, I think I'd like to see at least one other use case of this adapter to consider it worth including :)

Fair enough

This also seems like something that could be put into some kind of async utils crate

That might make more sense, yes

@sdroege
Copy link

sdroege commented Apr 25, 2020

There's also something like this in async-tungstenite, I believe it would be quite useful to have somewhere in a separate crate (there's async-stdio with something like this btw, but seems unmaintained and outdated) or even better as part of this (IMHO it fits the Async type here quite well).

For async-tungstenite there's a little problem though that the AsyncRead/AsyncWrite adapters would need to be able to remember two Wakers, see sdroege/async-tungstenite#14 for some details.

@ghost
Copy link

ghost commented Apr 27, 2020

This also reminds me of futures::io::AllowStdIo. Perhaps it would be a good addition to futures?

@ghost
Copy link

ghost commented May 3, 2020

Closing this issue - I think this should ideally live in some other crate.

@ghost ghost closed this as completed May 3, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants