diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-29 12:06:38 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-29 12:06:38 +0100 |
| commit | e36b8ed374423816876273f30b77eee38cb8b74c (patch) | |
| tree | 0fc976a6bc91c56926d4c9af1ce05cb0e0556a3e /src/geom | |
| parent | 50bd8634711507ead8491d8d0c2abad0481e6a83 (diff) | |
Layout bugfixes
Diffstat (limited to 'src/geom')
| -rw-r--r-- | src/geom/spec.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/geom/spec.rs b/src/geom/spec.rs index 16d63959..5d89c894 100644 --- a/src/geom/spec.rs +++ b/src/geom/spec.rs @@ -85,6 +85,27 @@ impl<T> Spec<T> { } } +impl<T> Spec<T> +where + T: Ord, +{ + /// The component-wise minimum of this and another instance. + pub fn min(self, other: Self) -> Self { + Self { + x: self.x.min(other.x), + y: self.y.min(other.y), + } + } + + /// The component-wise minimum of this and another instance. + pub fn max(self, other: Self) -> Self { + Self { + x: self.x.max(other.x), + y: self.y.max(other.y), + } + } +} + impl<T> Get<SpecAxis> for Spec<T> { type Component = T; |
