pub fn scale_to(&self, other: &UnitSet) -> Option<Number> {
        if let [(u, 1)] = other.units.as_slice() {
            self.scale_to_unit(u)
        } else if other.is_none() {
            self.scale_to_unit(&Unit::None)
        } else {
            let quote = self / other;
            if quote.dimension().is_empty() {
                Some(quote.units.iter().fold(one(), |a, (unit, power)| {
                    a * unit.scale_factor().powi((*power).into())
                }))
            } else {
                // self and other differs in dimension.
                None
            }
        }
    }
/// Get a scaling factor to convert this unit to another unit.
///
/// Returns None if the units are of different dimension.
Get a scaling factor to convert this unit to another unit.
Returns None if the units are of different dimension.
Get a scaling factor to convert this unit to another unit . Returns None if the units are of different dimension .
pub fn scale_to(&self, other: &UnitSet) -> Option<Number> {
        if let [(u, 1)] = other.units.as_slice() {
            self.scale_to_unit(u)
        } else if other.is_none() {
            self.scale_to_unit(&Unit::None)
        } else {
            let quote = self / other;
            if quote.dimension().is_empty() {
                Some(quote.units.iter().fold(one(), |a, (unit, power)| {
                    a * unit.scale_factor().powi((*power).into())
                }))
            } else {
                // self and other differs in dimension.
                None
            }
        }
    }
pub fn scale_to ( & self , other : & UnitSet ) -> Option < Number > { if let [ ( u , 1 ) ] = other . units . as_slice ( ) { self . scale_to_unit ( u ) } else if other . is_none ( ) { self . scale_to_unit ( & Unit :: None ) } else { let quote = self / other ; if quote . dimension ( ) . is_empty ( ) { Some ( quote . units . iter ( ) . fold ( one ( ) , | a , ( unit , power ) | { a * unit . scale_factor ( ) . powi ( ( * power ) . into ( ) ) } ) ) } else { // self and other differs in dimension. None } } }
Get a scaling factor to convert this unit to another unit.
Get a scaling factor to convert this unit to another unit .
&self
other
&UnitSet