[−][src]Trait uom::Conversion
Trait to identify units which have a conversion factor.
Generic Parameters
V
: Underlying storage type trait is implemented for.
Associated Types
type T: ConversionFactor<V>
Conversion factor type specific to the underlying storage type.
Provided methods
fn coefficient() -> Self::T
Coefficient portion of conversion factor for
converting the given unit to the base unit for the quantity: (value * coefficient()) + constant()
. Implementation should return the multiplicative identity (Self::T::one()
) if
no coefficient exists.
fn constant(op: ConstantOp) -> Self::T
Constant portion of conversion factor for
converting the given unit to the base unit for the quantity: (value * coefficient()) + constant()
. Implementation should return the additive identity (Self::T::zero()
) if no
constant exists. See ConstantOp documentation for details about
parameter use to ensure the method optimizes correctly.
fn into_conversion(&self) -> Self::T where
Self: Sized,
Self: Sized,
Instance conversion factor.
Default implementation returns the coefficient: Self::coefficient()
.