diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index 0a08bbe4..e417d08d 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -394,19 +394,3 @@ where } } } - -impl std::ops::Mul> for Rectangle -where - T: std::ops::Mul + Copy, -{ - type Output = Rectangle; - - fn mul(self, scale: Vector) -> Self { - Rectangle { - x: self.x * scale.x, - y: self.y * scale.y, - width: self.width * scale.x, - height: self.height * scale.y, - } - } -} diff --git a/core/src/size.rs b/core/src/size.rs index 539135bc..baa80b01 100644 --- a/core/src/size.rs +++ b/core/src/size.rs @@ -150,6 +150,20 @@ where } } +impl std::ops::Div for Size +where + T: std::ops::Div + Copy, +{ + type Output = Size; + + fn div(self, rhs: T) -> Self::Output { + Size { + width: self.width / rhs, + height: self.height / rhs, + } + } +} + impl std::ops::Mul> for Size where T: std::ops::Mul + Copy, diff --git a/core/src/vector.rs b/core/src/vector.rs index ff848c4f..4da0fa28 100644 --- a/core/src/vector.rs +++ b/core/src/vector.rs @@ -64,6 +64,17 @@ where } } +impl std::ops::Div for Vector +where + T: std::ops::Div + Copy, +{ + type Output = Self; + + fn div(self, scale: T) -> Self { + Self::new(self.x / scale, self.y / scale) + } +} + impl Default for Vector where T: Default,