-
Notifications
You must be signed in to change notification settings - Fork 635
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
FuturesUnordered + HashMap? #2329
Comments
I think it's a good idea to add something like a map. |
I'd think one could obtain that kind of behaviour with tokio's |
Would it be better to modify |
Yeah. I would prefer the latter. |
Really looking forward to use it |
I went ahead and wrote a library based on FuturesUnordered that does exactly this: https://github.com/StoicDeveloper/mapped_futures. I aim to publish it as a crate once I have some feedback. |
Here is the crate that covers this issue: https://crates.io/crates/mapped_futures |
@StoicDeveloper what was the motivation for making a separate crate instead of opening a PR, here? |
@allsey87 Honestly, it had not occurred to me to do so. I haven't really contributed to open source projects before. Mostly, I wanted to start using the feature immediately, whereas opening a PR would involve more discussion and require approval by the owners of this repo by meeting their standards, though of course that would be a very good thing for verifying the soundness of my |
We had a similar need with the added requirements of bounding the In case it is of interest, the code is here: https://github.com/libp2p/rust-libp2p/tree/master/misc/futures-bounded/src. |
I would like to have something like
FuturesUnordered
but where the collection behaves more like aHashMap
(so that I can easily look up a future by its key instead of using.iter().find()
etc). Has this been considered and if so, is there any reason this doesn't exist?I guess there is a good reason why the following also doesn't exist, but it would be awesome if somehow
FuturesOrdered
andFutureUnordered
could have been traits that were automatically implemented for any collection where the stored type implementsFuture
.The text was updated successfully, but these errors were encountered: