diff options
Diffstat (limited to 'src/geom/length.rs')
| -rw-r--r-- | src/geom/length.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/geom/length.rs b/src/geom/length.rs index c75f79b5..8bc50e97 100644 --- a/src/geom/length.rs +++ b/src/geom/length.rs @@ -79,11 +79,21 @@ impl Length { Self { raw: self.raw.min(other.raw) } } + /// Set to the minimum of this and another length. + pub fn set_min(&mut self, other: Self) { + *self = self.min(other); + } + /// The maximum of this and another length. pub fn max(self, other: Self) -> Self { Self { raw: self.raw.max(other.raw) } } + /// Set to the maximum of this and another length. + pub fn set_max(&mut self, other: Self) { + *self = self.max(other); + } + /// Whether the other length fits into this one (i.e. is smaller). pub fn fits(self, other: Self) -> bool { self.raw + 1e-6 >= other.raw |
