-
Notifications
You must be signed in to change notification settings - Fork 506
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 a parallel equivalent to Iterator::find_map #607
Comments
I think in our case, the easiest implementation would be something like: |
The actual implementation in fn find_map<B, F>(&mut self, mut f: F) -> Option<B> where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
{
self.try_for_each(move |x| {
match f(x) {
Some(x) => LoopState::Break(x),
None => LoopState::Continue(()),
}
}).break_value()
} We could do similar if we invent/copy a similar internal |
|
I'm taking a stab at implementing this. @cuviper I was thinking of implementing So basically Does that sound reasonable? |
I think we will want all of the variants, For some background, see the original addition of |
627: Add `find_map` with `any`, `first`, and `last` variants r=cuviper a=seanchen1991 PR opened in response to #607. 633: Update dev and demo dependencies r=cuviper a=cuviper - `cgmath 0.17` - `glium 0.23` - `rand 0.6` Co-authored-by: Sean <[email protected]> Co-authored-by: Josh Stone <[email protected]>
Done in #627. |
Iterator::find_map
is now stable in Rust 1.30:For
Iterator::find
, we have variantsParallelIterator::{find_any,find_first,find_last}
, so the user can be precise whether they care about the order. We should probably do similar forfind_map
, with some bikeshedding required...find_map_any
?find_any_map
?The text was updated successfully, but these errors were encountered: