-
Notifications
You must be signed in to change notification settings - Fork 632
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
Consider removing .boxed()
combinators and the Box
aliases
#228
Comments
Agreed we should consider, but I don't think this should block the 0.2 release, we can deprecate and message at any time. |
I think the problem becomes a problem when a function needs to return some futures. Say I have a function which could do async job A, B or C, and return one of them. Using a As the tuturial suggests using And it's not so obvious as a fact that |
Here's an example of someone getting tripped up by this: hyperium/hyper#1082 |
I once had an issue when the combined future type was too big and rustc refused to compile it with some strange So I'd like to point out that if you don't provide boxing methods others will probably extend it locally anyway. Maybe some of the current work on As an alternative I'd really like to see a |
I've also hit this issue and as a Rust newbie it took me a really lot of time to understand and solve the problem. The errors about the |
I noticed MaidSafe uses an extension trait with an |
I think to me it's relatively clear at this point that we'll be removing this method. If there's pretty solid agreement on that point we could go ahead and add a |
These methods have caused far more confusion than they were ever intended to cause, and they're use rarely enough in practice "to success" that they're likely to be removed from any 0.2 release. As a result this commit starts out the removal process by deprecating them and removing usage internally. Closes #228
These methods have caused far more confusion than they were ever intended to cause, and they're use rarely enough in practice "to success" that they're likely to be removed from any 0.2 release. As a result this commit starts out the removal process by deprecating them and removing usage internally. Closes #228
I've opened a PR for their removal in #556 |
In futures 0.1.15, the boxed() method on Future structs was deprecated. This returned a BoxFuture type which had to be declared either Send or 'static while wrapping a Future in Box::new() allows inference of the appropriate trait bounds. We already don't use the BoxFuture trait, so just call Box::new() directly instead to avoid the deprecation warning and make it easier to port to future releases. See also rust-lang/futures-rs#228
In futures 0.1.15, the boxed() method on Future structs was deprecated. This returned a BoxFuture type which had to be declared either Send or 'static while wrapping a Future in Box::new() allows inference of the appropriate trait bounds. We already don't use the BoxFuture trait, so just call Box::new() directly instead to avoid the deprecation warning and make it easier to port to future releases. See also rust-lang/futures-rs#228
The former is deprecated since futures 0.1.15, and has been removed in futures 0.2. See rust-lang/futures-rs#228
.boxed()
has to be hard coded to either beSend + 'static
or not. Where as callingBox::new
is able to infer which it should be. Given this, when a user tries to callboxed()
but the future is notSend
, a compilation error happens. I've noticed that this often causes confusion and it seems to be one of the more common questions that is asked in the gitter channel.I propose to remove
boxed
in favor of explicitly callingBox::new
.The text was updated successfully, but these errors were encountered: