http-rs / http-types

Common types for HTTP operations
https://docs.rs/http-types
Apache License 2.0
200 stars 83 forks source link

Suggestion: Use `oneshot::channel` instead of `async_std::channel` #329

Open Diggsey opened 3 years ago

Diggsey commented 3 years ago

There are a couple of places where a one-time channel is needed:

Currently these wrap the channel from async_std, but it would simplify things if they wrapped oneshot::channel from futures (or other similar channel) instead, as that channel offers the following benefits:

Since this is a breaking change to the signature of send, it should be done for the next major release.

jbr commented 3 years ago

http-types currently only has an optional dependency on async-std for the file system stuff. for channels, it uses async-channel on main currently: https://github.com/http-rs/http-types/blob/main/Cargo.toml#L32

Diggsey commented 3 years ago

Ah yes, though the benefits I mentioned of using a oneshot channel still apply.