You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
661 B
Rust

use crate::shapes::*;
/// An iterator containing the shapes to display
pub struct CircleShapes {
modulo: u32,
factor: u32,
position: u32,
circle: Circle,
}
impl CircleShapes {
pub fn new(modulo: u32, factor: u32, circle: Circle) -> CircleShapes {
CircleShapes {
modulo,
factor,
position: 0,
circle,
}
}
}
impl Iterator for CircleShapes {
type Item = Shape;
fn next(&mut self) -> Option<Self::Item> {
if self.position == 0 {
self.position += 1;
Some(Shape::Circle(self.circle))
} else {
None
}
}
}