smol-rs / futures-lite

Futures, streams, and async I/O combinators.
Apache License 2.0
427 stars 25 forks source link

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

Closed notgull closed 1 year ago

notgull commented 1 year ago

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 commented 1 year ago

Clippy error is unrelated to this PR, see #63