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 CoordsIter::exterior_coords_iter #594

Merged
merged 3 commits into from
Jan 5, 2021
Merged

Add CoordsIter::exterior_coords_iter #594

merged 3 commits into from
Jan 5, 2021

Conversation

frewsxcv
Copy link
Member

@frewsxcv frewsxcv commented Jan 4, 2021

  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

This will get incorporated into #592

Fixes #542

Based on and blocked by #593

@frewsxcv frewsxcv changed the title Frewsxcv ext iter Add CoordsIter::exterior_coords_iter Jan 4, 2021
@frewsxcv
Copy link
Member Author

frewsxcv commented Jan 4, 2021

Just merged in master, so this is ready for review

Copy link
Member

@michaelkirk michaelkirk left a comment

Choose a reason for hiding this comment

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

nice!

bors r+

@@ -313,6 +411,31 @@ impl<'a, T: CoordinateType + 'a> CoordsIter<'a> for Geometry<T> {
Geometry::Triangle(g) => g.coords_count(),
}
}

fn exterior_coords_iter(&'a self) -> Self::ExteriorIter {
match self {
Copy link
Member

Choose a reason for hiding this comment

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

Sometimes I wonder if we should adopt https://docs.rs/enum_dispatch/0.3.4/enum_dispatch/

{
type Item = Iter2::Iter;

fn next(&mut self) -> Option<Self::Item> {
self.0.next().map(|g| g.coords_iter())
}

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

Choose a reason for hiding this comment

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

👀 good catch

@bors
Copy link
Contributor

bors bot commented Jan 5, 2021

Build succeeded:

@bors bors bot merged commit c21a3cc into master Jan 5, 2021
@urschrei urschrei deleted the frewsxcv-ext-iter branch February 5, 2025 19:49
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.

Extend CoordsIter trait to have a exterior_coords_iter which iterates over exterior coordinates
2 participants