1 2 3 4 5 6 7 8 9 10 11 12 13
pub trait QuarterRotation where Self: Sized, { fn rotate_clockwise(&self) -> Self; fn rotate_counter_clockwise(&self) -> Self { // rotate clockwise 3 times is the same as rotate counter clockwise self.rotate_clockwise() .rotate_clockwise() .rotate_clockwise() } }