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

Polyline is unnecessarily restricting input type to slice of Points #680

Open
mchodzikiewicz opened this issue Jun 27, 2022 · 2 comments
Open
Milestone

Comments

@mchodzikiewicz
Copy link

mchodzikiewicz commented Jun 27, 2022

I am upgrading my forgotten crate to embedded-graphics 0.7.1, I'd like to get rid of my alternative polyline impl (called DrawableCurve), but here comes the problem:

  • I am mapping abstract coordinates into Polyline
  • Polyline is constructed using slice of Points

so I'd need to unnecessarily collect my conversion iterator just to create a polyline. If it would hold an iterator of points, it would be more flexible for instantiating Polylines from processed data.
See my (limited) implementation: https://gitlab.com/mchodzikiewicz/embedded-plots/-/blob/df0b244604b67ab88e44bfcd2bc946a53ecc4ed9/src/curve.rs#L121

@jamwaffles
Copy link
Member

This is a good idea, and should be possible (with a sizeable refactor). However, Polyline uses a lot of iteration over points internally, so I think the passed Iterator would also need a + Clone bound. Is this a dealbreaker for your specific case?

@mchodzikiewicz
Copy link
Author

mchodzikiewicz commented Jun 27, 2022

not a problem, my bounds are already I: Iterator<Item = Point> + Clone since I am dealing with the same problem in my DrawableCurve

Since I implemented it already for my crate, I might give it a try soon.

Any requirements / hints on your side?

@jamwaffles jamwaffles added this to the 0.8 milestone Oct 14, 2022
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

No branches or pull requests

2 participants