pub struct UnitSet { /* private fields */ }
Expand description
A set of units.
Eg. 10em * 10em
is an area of 100em².
Css does not support such arbitrary units, but sass does, and if
you divide it by a length you get a valid css length.
Implementations§
source§impl UnitSet
impl UnitSet
sourcepub fn is_percent(&self) -> bool
pub fn is_percent(&self) -> bool
Check if this UnitSet
is the percent unit.
sourcepub fn is_compatible(&self, other: &Self) -> bool
pub fn is_compatible(&self, other: &Self) -> bool
Check if this UnitSet
is compatible with another UnitSet
.
sourcepub fn scale_to(&self, other: &UnitSet) -> Option<Number>
pub fn scale_to(&self, other: &UnitSet) -> Option<Number>
Get a scaling factor to convert this unit to another unit.
Returns None if the units are of different dimension.
sourcepub fn scale_to_unit(&self, other: &Unit) -> Option<Number>
pub fn scale_to_unit(&self, other: &Unit) -> Option<Number>
Get a scaling factor to convert this unit to another unit.
Returns None if the units are of different dimension.
Trait Implementations§
source§impl PartialEq for UnitSet
impl PartialEq for UnitSet
impl Eq for UnitSet
impl StructuralEq for UnitSet
impl StructuralPartialEq for UnitSet
Auto Trait Implementations§
impl RefUnwindSafe for UnitSet
impl Send for UnitSet
impl Sync for UnitSet
impl Unpin for UnitSet
impl UnwindSafe for UnitSet
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more