dot_canvas/shape.rs
1pub trait Shape<'a> {
2 /// Returns an iterator over all points of the shape
3 fn points(&'a self) -> Box<dyn Iterator<Item = (f32, f32)> + 'a>;
4}
5
6pub struct Dot {
7 pub x: f32,
8 pub y: f32,
9}
10
11impl<'a> Shape<'a> for Dot {
12 fn points(&'a self) -> Box<dyn Iterator<Item = (f32, f32)> + 'a> {
13 Box::new(std::iter::once((self.x, self.y)))
14 }
15}