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

Add a combinator for temporarily using an AsyncRead/AsyncWrite as Read/Write #62

Merged
merged 5 commits into from
Nov 7, 2022

Conversation

notgull
Copy link
Member

@notgull notgull commented Nov 6, 2022

During smol-rs/async-rustls#9, @zseri pointed out that we frequently use a type that just converts an AsyncRead to a Read temporarily so that it can be used in rustls, which only takes a Read. This pattern is not unique to async-rustls, since I've also seen this used in tokio-tungstenite, following a similar pattern.

In order to deduplicate instances of this pattern throughout the ecosystem, this PR implements this pattern as a type in the io module.

@notgull
Copy link
Member Author

notgull commented Nov 6, 2022

Clippy error is unrelated to this PR, see #63

src/io.rs Outdated Show resolved Hide resolved
src/io.rs Outdated Show resolved Hide resolved
src/io.rs Outdated Show resolved Hide resolved
src/io.rs Outdated Show resolved Hide resolved
src/io.rs Show resolved Hide resolved
src/io.rs Outdated Show resolved Hide resolved
Co-authored-by: Alain Zscheile <[email protected]>
@fogti fogti merged commit a0871eb into master Nov 7, 2022
@fogti fogti deleted the sync-conversion branch November 7, 2022 08:26
@notgull notgull mentioned this pull request Apr 7, 2023
notgull added a commit that referenced this pull request Apr 7, 2023
- Unbind Debug implementations of BufReader and BufWriter. (#49)
- Add the once_future() combinator. (#59)
- Add a combinator for temporarily using an AsyncRead/AsyncWrite as Read/Write. (#62)
- Implement more methods for stream::BlockOn. (#68)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants