diff options
Diffstat (limited to 'src/geom/point.rs')
| -rw-r--r-- | src/geom/point.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/geom/point.rs b/src/geom/point.rs index babbdfef..8982dcea 100644 --- a/src/geom/point.rs +++ b/src/geom/point.rs @@ -26,6 +26,14 @@ impl Point { pub fn splat(value: Length) -> Self { Self { x: value, y: value } } + + /// Convert to the generic representation. + pub fn to_gen(self, main: SpecAxis) -> Gen<Length> { + match main { + SpecAxis::Horizontal => Gen::new(self.y, self.x), + SpecAxis::Vertical => Gen::new(self.x, self.y), + } + } } impl Get<SpecAxis> for Point { @@ -46,17 +54,6 @@ impl Get<SpecAxis> for Point { } } -impl Switch for Point { - type Other = Gen<Length>; - - fn switch(self, main: SpecAxis) -> Self::Other { - match main { - SpecAxis::Horizontal => Gen::new(self.y, self.x), - SpecAxis::Vertical => Gen::new(self.x, self.y), - } - } -} - impl Debug for Point { fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "Point({:?}, {:?})", self.x, self.y) |
