Skip to content

Implement ExactSizeIterator for CircularTupleWindows #660

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

Closed
xamgore opened this issue Nov 24, 2022 · 2 comments · Fixed by #752
Closed

Implement ExactSizeIterator for CircularTupleWindows #660

xamgore opened this issue Nov 24, 2022 · 2 comments · Fixed by #752

Comments

@xamgore
Copy link

xamgore commented Nov 24, 2022

.circular_tuple_windows() will produce the same amount of elements as the upstream iterator, so I believe the implementation should be pretty simple.

Speaking about the practical example, I want to convert a vector of 2D points to pairs of normalized vectors.

  let vecs = shape
    .into_iter()
    .circular_tuple_windows::<(_, _)>()
    .map(|((x1, y1), (x2, y2)): (Point, Point)| (x2 - x1, y2 - y1) as Point)
    .circular_tuple_windows(); //  trait `ExactSizeIterator` is not satisfied
@xamgore
Copy link
Author

xamgore commented Nov 25, 2023

@Philippe-Cholet what an excellent work, thank you so much! ❤️

@Philippe-Cholet
Copy link
Member

@xamgore You are welcome. Thanks for pointing that out.

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 a pull request may close this issue.

2 participants