embedded-graphics
embedded-graphics copied to clipboard
Polyline is unnecessarily restricting input type to slice of Points
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
Point
s
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
This is a good idea, and should be possible (with a sizeable refactor). However, Polyline
uses a lot of iteration over point
s internally, so I think the passed Iterator
would also need a + Clone
bound. Is this a dealbreaker for your specific case?
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?