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

Support parallel iteration with rayon #7

Merged
merged 1 commit into from
Jan 25, 2019

Conversation

alexcrichton
Copy link
Collaborator

This commit fleshes out a few iteration parts of this crate:

  • Adds IterMut and IntoIter iterators for the main Arena type.
  • Adds DoubleEndedIterator and ExactSizeIterator implementations to
    all iterators.
  • Adds a new optional feature, rayon, which enables linking to rayon
    and enabling parallel iteration of arenas (all three modes).

This commit fleshes out a few iteration parts of this crate:

* Adds `IterMut` and `IntoIter` iterators for the main `Arena` type.
* Adds `DoubleEndedIterator` and `ExactSizeIterator` implementations to
  all iterators.
* Adds a new optional feature, `rayon`, which enables linking to `rayon`
  and enabling parallel iteration of arenas (all three modes).
alexcrichton referenced this pull request in alexcrichton/id-arena Jan 25, 2019
Copy link
Owner

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Very nice! Thank you!

And yeah, impl trait in traits would make this a lot nicer...

add_id::<A, _>(self.iter.next(), self.arena_id)
}

fn size_hint(&self) -> (usize, Option<usize>) {
Copy link
Owner

Choose a reason for hiding this comment

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

Ah, nice catch 👍

@fitzgen
Copy link
Owner

fitzgen commented Jan 25, 2019

Will merge and fix the README locally.

@fitzgen fitzgen merged commit 7fc2e82 into fitzgen:master Jan 25, 2019
@alexcrichton alexcrichton deleted the parallel branch January 25, 2019 17:45
@alexcrichton
Copy link
Collaborator Author

Also FWIW the rayon bits are like 99% copied from the rayon-internal implementation of Map, there's no way I could generate all that off the top of my head

@fitzgen
Copy link
Owner

fitzgen commented Jan 25, 2019

Published 2.1.0!

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.

2 participants