-
Notifications
You must be signed in to change notification settings - Fork 641
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 bounds to combinators #2114
Comments
Note that adding trait bounds is a breaking change. |
Yes, and I think it's worth it. Futures is still not 1.0. |
One of the issues of doing this is the handling of complex bounds. futures-rs/futures-util/src/stream/try_stream/try_skip_while.rs Lines 41 to 43 in 1fa794a
This bounds is needed for The above example may be a bit extreme, but in the end, the actual issue is a diagnostics bug. (See |
Closing this in favor of upstream discussion. We can revisit this if rust-lang/api-guidelines#217 is accepted. |
You bring a good point and I think in this specific case my point still holds. However one could imagine a type that does something useful for both stream and sink (e.g buffering) in such case I would suggest not bounding the struct but still have two constructors - one for sink, one for stream. So thanks for reminding about this scenario. |
I expanded on the idea in the related issue, hope it's more clear now. |
I suggest adding
Future
andStream
bounds to combinators wherever appropriate based on this argument: rust-lang/api-guidelines#217Acording to recent reddit post type errors around
futures
are common (I share the same experience with0.1
, didn't check0.3
)At least until someone comes up with a magical solution for those type errors (which would be awesome because we could safely drop types from function signatures too).
The text was updated successfully, but these errors were encountered: