Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdds search unordered items in parallel example #337
Conversation
This comment has been minimized.
This comment has been minimized.
|
Didn't mean for c3f4a42 do be included in this.. I will rebase and push and update |
j-haj
force-pushed the
j-haj:rayon-search
branch
from
234ba46
to
709d96a
Oct 17, 2017
budziq
requested changes
Oct 17, 2017
| let f2 = v.par_iter().find_any(|&&x| x % 2 == 0 && x > 6); | ||
| let f3 = v.par_iter().find_any(|&&x| x > 8); | ||
| if let Some(found_9) = f1 { |
This comment has been minimized.
This comment has been minimized.
budziq
Oct 17, 2017
Collaborator
How about writing it more concisely as
assert_eq!(f1, Some(&9));
assert_eq!(f2, Some(&8));
assert!(f3 > Some(&8))
This comment has been minimized.
This comment has been minimized.
j-haj
Oct 17, 2017
Author
Contributor
This is much cleaner. It did not occur to me to convert the expected value into an optional. Very clever!
| @@ -72,6 +73,46 @@ fn main() { | |||
| } | |||
| ``` | |||
|
|
|||
| [ex-rayon-parallel-search]: #ex-rayon-parallel-search | |||
| <a name="ex-rayon-parallel-search"></a> | |||
| ## Search unordered items in parallel | |||
This comment has been minimized.
This comment has been minimized.
budziq
Oct 17, 2017
Collaborator
Hmm we might want to change the example title to something along the lines of
"Search items with given predicate in parallel". Originally the "unordered" part was to emphasize that we are not doing binary search but I think that mentioning the arbitrary predicate is a stronger usecase.
This comment has been minimized.
This comment has been minimized.
|
Great suggestions! I'll push some updates later this evening |
j-haj
force-pushed the
j-haj:rayon-search
branch
from
709d96a
to
bde8bb6
Oct 18, 2017
This comment has been minimized.
This comment has been minimized.
|
I slightly modified the suggested title to "Search items using given predicate in parallel" to make it clear the predicate is associated with the search rather than the items. |
budziq
merged commit de94b25
into
rust-lang-nursery:master
Oct 24, 2017
This comment has been minimized.
This comment has been minimized.
|
Nicely done @j-haj ! |
j-haj commentedOct 17, 2017
cc #330