pub type AmountT = f64;Expand description
Type used for the numerical part of a Quantity.
When feature fpdec is off (= default), AmountT is defined as f64 on a
64-bit system or as f32 on a 32-bit system.
When feature fpdec is activated, AmountT is defined as Decimal
(imported from crate fpdec).
The macro Amnt! can be used to convert float literals correctly to
AmountT depending on the configuration.
Trait Implementations§
Source§impl HasRefUnit for AmountT
impl HasRefUnit for AmountT
Source§fn unit_from_scale(amnt: AmountT) -> Option<Self::UnitType>
fn unit_from_scale(amnt: AmountT) -> Option<Self::UnitType>
Returns
Some(unit) where unit.scale() == amnt, or None if
there is no such unit.Source§fn equiv_amount(&self, unit: Self::UnitType) -> AmountT
fn equiv_amount(&self, unit: Self::UnitType) -> AmountT
Returns
factor so that factor * unit == self.Source§fn convert(&self, to_unit: Self::UnitType) -> Self
fn convert(&self, to_unit: Self::UnitType) -> Self
Returns
qty where qty == self and qty.unit() is to_unit.Source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Returns true, if
self and other have equivalent amounts, otherwise
false.Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
Returns the partial order of
selfs amount and others eqivalent
amount in selfs unit.Source§impl Mul<Acceleration> for AmountT
impl Mul<Acceleration> for AmountT
Source§type Output = Acceleration
type Output = Acceleration
The resulting type after applying the
* operator.Source§impl Mul<AccelerationUnit> for AmountT
impl Mul<AccelerationUnit> for AmountT
Source§type Output = Acceleration
type Output = Acceleration
The resulting type after applying the
* operator.Source§impl Mul<DataThroughput> for AmountT
impl Mul<DataThroughput> for AmountT
Source§type Output = DataThroughput
type Output = DataThroughput
The resulting type after applying the
* operator.Source§impl Mul<DataThroughputUnit> for AmountT
impl Mul<DataThroughputUnit> for AmountT
Source§type Output = DataThroughput
type Output = DataThroughput
The resulting type after applying the
* operator.Source§impl Mul<DataVolume> for AmountT
impl Mul<DataVolume> for AmountT
Source§type Output = DataVolume
type Output = DataVolume
The resulting type after applying the
* operator.Source§impl Mul<DataVolumeUnit> for AmountT
impl Mul<DataVolumeUnit> for AmountT
Source§type Output = DataVolume
type Output = DataVolume
The resulting type after applying the
* operator.Source§impl Mul<DurationUnit> for AmountT
impl Mul<DurationUnit> for AmountT
Source§impl Mul<EnergyUnit> for AmountT
impl Mul<EnergyUnit> for AmountT
Source§impl Mul<FrequencyUnit> for AmountT
impl Mul<FrequencyUnit> for AmountT
Source§impl Mul<LengthUnit> for AmountT
impl Mul<LengthUnit> for AmountT
Source§impl Mul<Temperature> for AmountT
impl Mul<Temperature> for AmountT
Source§type Output = Temperature
type Output = Temperature
The resulting type after applying the
* operator.Source§impl Mul<TemperatureUnit> for AmountT
impl Mul<TemperatureUnit> for AmountT
Source§type Output = Temperature
type Output = Temperature
The resulting type after applying the
* operator.Source§impl Mul<VolumeUnit> for AmountT
impl Mul<VolumeUnit> for AmountT
Source§impl Quantity for AmountT
impl Quantity for AmountT
Source§fn new(amount: AmountT, _unit: Self::UnitType) -> Self
fn new(amount: AmountT, _unit: Self::UnitType) -> Self
Returns a new instance of the type implementing
Quantity.Source§fn iter_units() -> impl Iterator<Item = Self::UnitType>
fn iter_units() -> impl Iterator<Item = Self::UnitType>
Returns an iterator over the variants of
Self::UnitType.Source§fn unit_from_symbol(symbol: &str) -> Option<Self::UnitType>
fn unit_from_symbol(symbol: &str) -> Option<Self::UnitType>
Returns
Some(unit) where unit.symbol() == symbol, or None if
there is no such unit.Source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Return
true if self and other have the same unit and their
amounts are equal, otherwise false.Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
Returns the partial order of
selfs and others amounts, if both
have the same unit, otherwise None.