Skip to content
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 examples to par_split_mut and par_chunks_mut #530

Merged
merged 1 commit into from
Feb 14, 2018

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Feb 12, 2018

Also add an odd tail to the par_chunks example.

cc #420

Also add an odd tail to the `par_chunks` example.
/// let windows: Vec<_> = [1, 2, 3, 4].par_chunks(2).collect();
/// assert_eq!(vec![[1, 2], [3, 4]], windows);
/// let chunks: Vec<_> = [1, 2, 3, 4, 5].par_chunks(2).collect();
/// assert_eq!(chunks, vec![&[1, 2][..], &[3, 4], &[5]]);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the trailing [..] here, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be forced as a slice instead of array, or else the type of [5] won't match.

I think I could do this like let expected: Vec<&[_]> = ... if that's clearer.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yep. I personally think the way it is now is fine to read, I was just nit-picking for the sake of the review.

@nikomatsakis
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Feb 14, 2018
528: Replace coco with crossbeam-deque r=nikomatsakis a=cuviper

These are the changes from @stjepang and @jeehoonkang, replacing and closing #480.  The minimum rustc is *slightly* increased from 1.12 to 1.13 for the transitive requirements.

530: Add examples to par_split_mut and par_chunks_mut r=nikomatsakis a=cuviper

Also add an odd tail to the `par_chunks` example.

cc #420
@bors
Copy link
Contributor

bors bot commented Feb 14, 2018

@bors bors bot merged commit 8c41708 into rayon-rs:master Feb 14, 2018
@cuviper cuviper deleted the slicemut-examples branch October 18, 2018 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants