-
Notifications
You must be signed in to change notification settings - Fork 501
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 examples to the module docs #411
Conversation
|
Ah, I did not know that. I added a note to the docs. |
I cherry-picked your CI fixes in #436. If you'll please rebase the rest of your changes, we can see how CI fares now. |
7026b02
to
286f82f
Compare
Rebased and tested. Thank you for the cerry-picking. |
src/range.rs
Outdated
//! | ||
//! let r = (0..100u64).into_par_iter() | ||
//! .fold(|| 0, |acc, cur| acc + cur) | ||
//! .sum(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice in both examples you use .fold(...).sum()
, when just .sum()
should work fine. Was this intentional?
src/range.rs
Outdated
|
||
use iter::*; | ||
use iter::internal::*; | ||
use std::ops::Range; | ||
|
||
/// Parallel iterator over a range | ||
/// Implemented for `u32`, `i32`, `usize` and `isize`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a blank doc-line between the intro and additional description. Or if you want it as one intro paragraph, then it needs punctuation between the clauses.
Also, ParallelIterator
is implemented for range::Iter<T>
of all integer types. The difference is just that i64
and u64
don't implement IndexedParallelIterator
, which you'd need for zip
, for example.
7b7560b
to
a7a1e6a
Compare
Hm the |
Would you like me to squash the commits? |
a7a1e6a
to
8f5464e
Compare
src/iter/mod.rs
Outdated
@@ -781,6 +781,8 @@ impl<T: ParallelIterator> IntoParallelIterator for T { | |||
/// An iterator that supports "random access" to its data, meaning | |||
/// that you can split it at arbitrary indices and draw data from | |||
/// those points. | |||
/// | |||
/// **Note:** Not implemented for `u64` and `i64` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small clarification, please: "Not implemented for u64
and i64
ranges."
Yeah, let's squash this one to its final state, thanks! |
Fixed and squashed. Greetings from the RustFest impl days |
Thanks! |
Hi
I wanted to add examples to the docs. My first example works as I expected.
My second example behaves very strange. It compiles when I use
i32
as the type of theRange<T>
.With any other type such as
usize
,u64
ori64
it does not compile.Do you have an idea how to fix it?
Regards
Error message: