fn scale_factor(&self) -> NumValue {
        match *self {
            Unit::Em | Unit::Rem => NumValue::rational(10, 2),
            Unit::Ex => NumValue::rational(10, 3),
            Unit::Ch => NumValue::rational(10, 4),
            Unit::Vw | Unit::Vh | Unit::Vmin | Unit::Vmax => NumValue::one(),
            Unit::Cm => NumValue::rational(10, 1),
            Unit::Mm => NumValue::one(),
            Unit::Q => NumValue::rational(1, 4),
            Unit::In => NumValue::rational(254, 10),
            Unit::Pt => NumValue::rational(254, 720),
            Unit::Pc => NumValue::rational(254, 60),
            Unit::Px => NumValue::rational(254, 960),

            Unit::Deg => NumValue::rational(1, 360),
            Unit::Grad => NumValue::rational(1, 400),
            Unit::Rad => NumValue::Float(FRAC_1_PI / 2.0), // 1/(2 pi)
            Unit::Turn => NumValue::one(),

            Unit::S => NumValue::one(),
            Unit::Ms => NumValue::rational(1, 1000),

            Unit::Hz => NumValue::one(),
            Unit::Khz => NumValue::rational(1000, 1),

            Unit::Dpi => NumValue::rational(96, 1),
            Unit::Dpcm => NumValue::rational(9600, 254),
            Unit::Dppx => NumValue::one(),

            Unit::Percent => NumValue::rational(1, 100),
            Unit::Fr => NumValue::one(),
            Unit::None => NumValue::one(),
        }
    }
/// Some of these are exact and correct, others are more arbitrary.
/// When comparing 10cm to 4in, these factors will give correct results.
/// When comparing rems to vw, who can say?
Some of these are exact and correct, others are more arbitrary.
When comparing 10cm to 4in, these factors will give correct results.
Some of these are exact and correct others are more arbitrary . When comparing 10cm to 4in these factors will give correct results .
fn scale_factor(&self) -> NumValue {
        match *self {
            Unit::Em | Unit::Rem => NumValue::rational(10, 2),
            Unit::Ex => NumValue::rational(10, 3),
            Unit::Ch => NumValue::rational(10, 4),
            Unit::Vw | Unit::Vh | Unit::Vmin | Unit::Vmax => NumValue::one(),
            Unit::Cm => NumValue::rational(10, 1),
            Unit::Mm => NumValue::one(),
            Unit::Q => NumValue::rational(1, 4),
            Unit::In => NumValue::rational(254, 10),
            Unit::Pt => NumValue::rational(254, 720),
            Unit::Pc => NumValue::rational(254, 60),
            Unit::Px => NumValue::rational(254, 960),
            Unit::Deg => NumValue::rational(1, 360),
            Unit::Grad => NumValue::rational(1, 400),
            Unit::Rad => NumValue::Float(FRAC_1_PI / 2.0), // 1/(2 pi)
            Unit::Turn => NumValue::one(),
            Unit::S => NumValue::one(),
            Unit::Ms => NumValue::rational(1, 1000),
            Unit::Hz => NumValue::one(),
            Unit::Khz => NumValue::rational(1000, 1),
            Unit::Dpi => NumValue::rational(96, 1),
            Unit::Dpcm => NumValue::rational(9600, 254),
            Unit::Dppx => NumValue::one(),
            Unit::Percent => NumValue::rational(1, 100),
            Unit::Fr => NumValue::one(),
            Unit::None => NumValue::one(),
        }
    }
fn scale_factor ( & self ) -> NumValue { match * self { Unit :: Em | Unit :: Rem => NumValue :: rational ( 10 , 2 ) , Unit :: Ex => NumValue :: rational ( 10 , 3 ) , Unit :: Ch => NumValue :: rational ( 10 , 4 ) , Unit :: Vw | Unit :: Vh | Unit :: Vmin | Unit :: Vmax => NumValue :: one ( ) , Unit :: Cm => NumValue :: rational ( 10 , 1 ) , Unit :: Mm => NumValue :: one ( ) , Unit :: Q => NumValue :: rational ( 1 , 4 ) , Unit :: In => NumValue :: rational ( 254 , 10 ) , Unit :: Pt => NumValue :: rational ( 254 , 720 ) , Unit :: Pc => NumValue :: rational ( 254 , 60 ) , Unit :: Px => NumValue :: rational ( 254 , 960 ) , Unit :: Deg => NumValue :: rational ( 1 , 360 ) , Unit :: Grad => NumValue :: rational ( 1 , 400 ) , Unit :: Rad => NumValue :: Float ( FRAC_1_PI / 2.0 ) , // 1/(2 pi) Unit :: Turn => NumValue :: one ( ) , Unit :: S => NumValue :: one ( ) , Unit :: Ms => NumValue :: rational ( 1 , 1000 ) , Unit :: Hz => NumValue :: one ( ) , Unit :: Khz => NumValue :: rational ( 1000 , 1 ) , Unit :: Dpi => NumValue :: rational ( 96 , 1 ) , Unit :: Dpcm => NumValue :: rational ( 9600 , 254 ) , Unit :: Dppx => NumValue :: one ( ) , Unit :: Percent => NumValue :: rational ( 1 , 100 ) , Unit :: Fr => NumValue :: one ( ) , Unit :: None => NumValue :: one ( ) , } }
Some of these are exact and correct, others are more arbitrary.
Some of these are exact and correct others are more arbitrary .
&self
&self