Skip to main content

AmountT

Type Alias AmountT 

Source
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 Div<&Duration> for &AmountT

Source§

type Output = <f64 as Div<Duration>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Duration) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<&Duration> for AmountT
where Self: Div<Duration>,

Source§

type Output = <f64 as Div<Duration>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Duration) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<&Frequency> for &AmountT

Source§

type Output = <f64 as Div<Frequency>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Frequency) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<&Frequency> for AmountT
where Self: Div<Frequency>,

Source§

type Output = <f64 as Div<Frequency>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Frequency) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<Duration> for &'a AmountT

Source§

type Output = <f64 as Div<Duration>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Duration) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<Duration> for AmountT

Source§

type Output = Frequency

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Duration) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<Frequency> for &'a AmountT

Source§

type Output = <f64 as Div<Frequency>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Frequency) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<Frequency> for AmountT

Source§

type Output = Duration

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Frequency) -> Self::Output

Performs the / operation. Read more
Source§

impl HasRefUnit for AmountT

Source§

const REF_UNIT: One = ONE

Unit used as reference for scaling the units of Self::UnitType.
Source§

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

Returns factor so that factor * unit == self.
Source§

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

Returns true, if self and other have equivalent amounts, otherwise false.
Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

Returns the partial order of selfs amount and others eqivalent amount in selfs unit.
Source§

fn add(self, rhs: Self) -> Self

Returns the sum of self and other
Source§

fn sub(self, rhs: Self) -> Self

Returns the difference between self and other
Source§

fn div(self, rhs: Self) -> AmountT

Returns the quotient self / other
Source§

impl Mul<Acceleration> for AmountT

Source§

type Output = Acceleration

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Acceleration) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<AccelerationUnit> for AmountT

Source§

type Output = Acceleration

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: AccelerationUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Area> for AmountT

Source§

type Output = Area

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Area) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<AreaUnit> for AmountT

Source§

type Output = Area

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: AreaUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<DataThroughput> for AmountT

Source§

type Output = DataThroughput

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: DataThroughput) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<DataThroughputUnit> for AmountT

Source§

type Output = DataThroughput

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: DataThroughputUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<DataVolume> for AmountT

Source§

type Output = DataVolume

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: DataVolume) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<DataVolumeUnit> for AmountT

Source§

type Output = DataVolume

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: DataVolumeUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Duration> for AmountT

Source§

type Output = Duration

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Duration) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<DurationUnit> for AmountT

Source§

type Output = Duration

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: DurationUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Energy> for AmountT

Source§

type Output = Energy

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Energy) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<EnergyUnit> for AmountT

Source§

type Output = Energy

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: EnergyUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Force> for AmountT

Source§

type Output = Force

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Force) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<ForceUnit> for AmountT

Source§

type Output = Force

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: ForceUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Frequency> for AmountT

Source§

type Output = Frequency

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Frequency) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<FrequencyUnit> for AmountT

Source§

type Output = Frequency

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: FrequencyUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Length> for AmountT

Source§

type Output = Length

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Length) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<LengthUnit> for AmountT

Source§

type Output = Length

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: LengthUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Mass> for AmountT

Source§

type Output = Mass

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Mass) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<MassUnit> for AmountT

Source§

type Output = Mass

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: MassUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<One> for AmountT

Source§

type Output = f64

The resulting type after applying the * operator.
Source§

fn mul(self, _rhs: One) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Power> for AmountT

Source§

type Output = Power

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Power) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<PowerUnit> for AmountT

Source§

type Output = Power

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: PowerUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Speed> for AmountT

Source§

type Output = Speed

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Speed) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<SpeedUnit> for AmountT

Source§

type Output = Speed

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SpeedUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Temperature> for AmountT

Source§

type Output = Temperature

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Temperature) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<TemperatureUnit> for AmountT

Source§

type Output = Temperature

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: TemperatureUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Volume> for AmountT

Source§

type Output = Volume

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Volume) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<VolumeUnit> for AmountT

Source§

type Output = Volume

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: VolumeUnit) -> Self::Output

Performs the * operation. Read more
Source§

impl Quantity for AmountT

Source§

type UnitType = One

Associated type of unit
Source§

fn new(amount: AmountT, _unit: Self::UnitType) -> Self

Returns a new instance of the type implementing Quantity.
Source§

fn amount(&self) -> AmountT

Returns the amount of self.
Source§

fn unit(&self) -> Self::UnitType

Returns the unit of self.
Source§

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>

Returns Some(unit) where unit.symbol() == symbol, or None if there is no such unit.
Source§

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>

Returns the partial order of selfs and others amounts, if both have the same unit, otherwise None.
Source§

fn add(self, rhs: Self) -> Self

Returns the sum of self and other, if both have the same unit. Read more
Source§

fn sub(self, rhs: Self) -> Self

Returns the difference between self and other, if both have the same unit. Read more
Source§

fn div(self, rhs: Self) -> AmountT

Returns the quotient self / other, if both have the same unit. Read more
Source§

fn fmt(&self, form: &mut Formatter<'_>) -> Result

Formats self using the given formatter. Read more