diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-10-03 15:07:57 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-10-03 15:07:57 +0200 |
| commit | 95bae5725cf6495644e2593f8492f1cd0e5bd3c1 (patch) | |
| tree | 919dd90cac7623bcbbc09d9c92399eaa65e537f2 /src/length.rs | |
| parent | 0fc25d732d7cbc37cf801645849d1060f2cec4a3 (diff) | |
Int, Float, Relative and Linear values 🍉
Diffstat (limited to 'src/length.rs')
| -rw-r--r-- | src/length.rs | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/length.rs b/src/length.rs index fb62763e..437c741d 100644 --- a/src/length.rs +++ b/src/length.rs @@ -177,38 +177,6 @@ impl Display for ParseLengthError { } } -/// Either an absolute length or a factor of some entity. -#[derive(Copy, Clone, PartialEq)] -pub enum ScaleLength { - Absolute(Length), - Scaled(f64), -} - -impl ScaleLength { - /// Use the absolute value or scale the entity. - pub fn raw_scaled(&self, entity: f64) -> f64 { - match *self { - ScaleLength::Absolute(l) => l.as_raw(), - ScaleLength::Scaled(s) => s * entity, - } - } -} - -impl Display for ScaleLength { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { - match self { - ScaleLength::Absolute(length) => write!(f, "{}", length), - ScaleLength::Scaled(scale) => write!(f, "{}%", scale * 100.0), - } - } -} - -impl Debug for ScaleLength { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { - Display::fmt(self, f) - } -} - #[cfg(test)] mod tests { use super::*; |
