pub struct MeasureUnit { /* private fields */ }
Expand description
The MeasureUnit
struct represents a processed CLDR compound unit.
Examples include:
meter-per-second
square-meter
liter-per-100-kilometer
portion-per-1e9
square-meter
(Note: a single unit is a special case of a compound unit containing only one single unit.)
To construct a MeasureUnit
from a CLDR unit identifier, use the crate::measure::parser::MeasureUnitParser
.
Implementations§
Source§impl MeasureUnit
impl MeasureUnit
Sourcepub fn get_single_units(&self) -> &SmallVec<[SingleUnit; 8]>
pub fn get_single_units(&self) -> &SmallVec<[SingleUnit; 8]>
Returns a reference to the single units contained within this measure unit.
Sourcepub fn get_constant_denominator(&self) -> u64
pub fn get_constant_denominator(&self) -> u64
Returns the constant denominator of this measure unit.
NOTE:
If the constant denominator is not set, a value of 0
is returned.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MeasureUnit
impl RefUnwindSafe for MeasureUnit
impl Send for MeasureUnit
impl Sync for MeasureUnit
impl Unpin for MeasureUnit
impl UnwindSafe for MeasureUnit
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more