diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-23 22:04:08 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-23 22:04:08 +0100 |
| commit | 8a88f71cb11565c1a78bd57f02a8df17cb2bf7a0 (patch) | |
| tree | 8802c1ff48e2be118e3872d25bd2f2c1f7a21b4a /src/geom/relative.rs | |
| parent | c77c5a0f0ae6560a03a85e847006c29de9c7ae62 (diff) | |
Transformations
Diffstat (limited to 'src/geom/relative.rs')
| -rw-r--r-- | src/geom/relative.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/geom/relative.rs b/src/geom/relative.rs index 463c5d46..c894f4a5 100644 --- a/src/geom/relative.rs +++ b/src/geom/relative.rs @@ -5,6 +5,7 @@ use super::*; /// _Note_: `50%` is represented as `0.5` here, but stored as `50.0` in the /// corresponding [literal](crate::syntax::ast::LitKind::Percent). #[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Serialize, Deserialize)] pub struct Relative(Scalar); impl Relative { @@ -73,6 +74,14 @@ impl Add for Relative { sub_impl!(Relative - Relative -> Relative); +impl Mul for Relative { + type Output = Self; + + fn mul(self, other: Self) -> Self { + Self(self.0 * other.0) + } +} + impl Mul<f64> for Relative { type Output = Self; @@ -107,5 +116,6 @@ impl Div for Relative { assign_impl!(Relative += Relative); assign_impl!(Relative -= Relative); +assign_impl!(Relative *= Relative); assign_impl!(Relative *= f64); assign_impl!(Relative /= f64); |
