use crate::Point; use std::ops::{Rem, RemAssign}; use num::Integer; /* P % T P % (T, T) P % P P % &P P % &mP &P % T &P % (T, T) &P % P &P % &P &P % &mP &mP % T &mP % (T, T) &mP % P &mP % &P &mP % &mP P %= T P %= (T, T) P %= P P %= &P P %= &mP */ impl Rem for Point { type Output = Self; fn rem(self, rhs: T) -> Self::Output { Self::from((self.x%rhs, self.y%rhs)) } } impl Rem<(T, T)> for Point { type Output = Self; fn rem(self, rhs: (T, T)) -> Self::Output { Self::from((self.x%rhs.0, self.y%rhs.1)) } } impl Rem> for Point { type Output = Self; fn rem(self, rhs: Point) -> Self::Output { Self::from((self.x%rhs.x, self.y%rhs.y)) } } impl Rem<&Point> for Point { type Output = Self; fn rem(self, rhs: &Point) -> Self::Output { Self::from((self.x%rhs.x, self.y%rhs.y)) } } impl Rem<&mut Point> for Point { type Output = Self; fn rem(self, rhs: &mut Point) -> Self::Output { Self::from((self.x%rhs.x, self.y%rhs.y)) } } impl Rem for &Point { type Output = Point; fn rem(self, rhs: T) -> Self::Output { Point::from((self.x%rhs, self.y%rhs)) } } impl Rem<(T, T)> for &Point { type Output = Point; fn rem(self, rhs: (T, T)) -> Self::Output { Point::from((self.x%rhs.0, self.y%rhs.1)) } } impl Rem> for &Point { type Output = Point; fn rem(self, rhs: Point) -> Self::Output { Point::from((self.x%rhs.x, self.y%rhs.y)) } } impl Rem<&Point> for &Point { type Output = Point; fn rem(self, rhs: &Point) -> Self::Output { Point::from((self.x%rhs.x, self.y%rhs.y)) } } impl Rem<&mut Point> for &Point { type Output = Point; fn rem(self, rhs: &mut Point) -> Self::Output { Point::from((self.x%rhs.x, self.y%rhs.y)) } } impl Rem for &mut Point { type Output = Point; fn rem(self, rhs: T) -> Self::Output { Point::from((self.x%rhs, self.y%rhs)) } } impl Rem<(T, T)> for &mut Point { type Output = Point; fn rem(self, rhs: (T, T)) -> Self::Output { Point::from((self.x%rhs.0, self.y%rhs.1)) } } impl Rem> for &mut Point { type Output = Point; fn rem(self, rhs: Point) -> Self::Output { Point::from((self.x%rhs.x, self.y%rhs.y)) } } impl Rem<&Point> for &mut Point { type Output = Point; fn rem(self, rhs: &Point) -> Self::Output { Point::from((self.x%rhs.x, self.y%rhs.y)) } } impl Rem<&mut Point> for &mut Point { type Output = Point; fn rem(self, rhs: &mut Point) -> Self::Output { Point::from((self.x%rhs.x, self.y%rhs.y)) } } impl RemAssign for Point { fn rem_assign(&mut self, rhs: T) { self.x %= rhs; self.y %= rhs; } } impl RemAssign<(T, T)> for Point { fn rem_assign(&mut self, rhs: (T, T)) { self.x %= rhs.0; self.y %= rhs.1; } } impl RemAssign> for Point { fn rem_assign(&mut self, rhs: Point) { self.x %= rhs.x; self.y %= rhs.y; } } impl RemAssign<&Point> for Point { fn rem_assign(&mut self, rhs: &Point) { self.x %= rhs.x; self.y %= rhs.y; } } impl RemAssign<&mut Point> for Point { fn rem_assign(&mut self, rhs: &mut Point) { self.x %= rhs.x; self.y %= rhs.y; } }