diff --git a/src/insets.rs b/src/insets.rs index 03dd214a..b52a0b11 100644 --- a/src/insets.rs +++ b/src/insets.rs @@ -3,7 +3,7 @@ //! A description of the distances between the edges of two rectangles. -use core::ops::{Add, Neg, Sub}; +use core::ops::{Add, Div, Mul, Neg, Sub}; use crate::{Rect, Size}; @@ -279,6 +279,32 @@ impl Sub for Insets { } } +impl Mul for Insets { + type Output = Insets; + + fn mul(self, rhs: f64) -> Self::Output { + Self { + x0: self.x0 * rhs, + y0: self.y0 * rhs, + x1: self.x1 * rhs, + y1: self.y1 * rhs, + } + } +} + +impl Div for Insets { + type Output = Insets; + + fn div(self, rhs: f64) -> Self::Output { + Self { + x0: self.x0 / rhs, + y0: self.y0 / rhs, + x1: self.x1 / rhs, + y1: self.y1 / rhs, + } + } +} + impl Sub for Rect { type Output = Rect;