#[repr(transparent)]pub struct Quantity<D, U, V>{
pub dimension: PhantomData<D>,
pub units: PhantomData<U>,
pub value: V,
}
Expand description
Property of a phenomenon, body or substance, where the property has a magnitude that can be expressed as a number and a reference.
The preferred method of creating a Quantity
instance is to use the new
constructor
which is generic over the input unit and accepts the input value as it’s only
parameter.
// Create a length of 1 meter.
let l = Length::new::<meter>(1.0);
Quantity
fields are public to allow for the creation of const
values and instances
of non-named Quantity
s. This functionality will be deprecated and subsequently removed
once the const fn
feature is
stabilized.
// Create a `const` length of 1 meter.
const L: Length = Length { dimension: PhantomData, units: PhantomData, value: 1.0, };
// Create a `const` area of 1 square meter explicitly without using the `Area` alias.
const A: Quantity<ISQ<P2, Z0, Z0, Z0, Z0, Z0, Z0>, SI<f32>, f32> =
Quantity { dimension: PhantomData, units: PhantomData, value: 1.0, };
Using units for the wrong quantity will cause a compile error:
// error[E0277]: the trait bound `second: length::Unit` is not satisfied
let l = Length::new::<second>(1.0);
Mixing quantities will also cause a compile error:
// error[E0308]: mismatched types
let r = Length::new::<meter>(1.0) + Time::new::<second>(1.0);
// error[E0308]: mismatched types
let v: Velocity = Length::new::<meter>(1.0) * Time::new::<second>(1.0);
§Generic Parameters
Fields§
§dimension: PhantomData<D>
Quantity dimension. See Dimension
.
units: PhantomData<U>
Quantity base units. See Units
.
value: V
Quantity value stored in the base units for the quantity.
Implementations§
Source§impl<U, V> Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, U, V>
impl<U, V> Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, U, V>
Sourcepub fn floor<N>(self) -> Self
pub fn floor<N>(self) -> Self
Returns the largest integer less than or equal to a number in the given measurement unit.
§Generic Parameters
N
: Unit.
Sourcepub fn ceil<N>(self) -> Self
pub fn ceil<N>(self) -> Self
Returns the smallest integer less than or equal to a number in the given measurement unit.
§Generic Parameters
N
: Unit.
Sourcepub fn round<N>(self) -> Self
pub fn round<N>(self) -> Self
Returns the nearest integer to a number in the in given measurement unit. Round half-way cases away from 0.0.
§Generic Parameters
N
: Unit.
Sourcepub fn format_args<N>(_unit: N, style: DisplayStyle) -> Arguments<Dimension, N>where
N: Unit,
pub fn format_args<N>(_unit: N, style: DisplayStyle) -> Arguments<Dimension, N>where
N: Unit,
Creates a struct that can be used to format a compatible quantity for display.
§Notes
The return value of this method cannot be used to print directly, but is instead
used to format quantities and can be reused; see
Arguments::with
and the examples below.
If you do not need to format multiple quantities, consider using
into_format_args
instead.
§Examples
let t1 = Time::new::<femtosecond>(1.0_E-1);
let t2 = Time::new::<picosecond>(1.0_E-1);
let a = Time::format_args(femtosecond, Description);
assert_eq!("0.1 femtoseconds", format!("{}", a.with(t1)));
assert_eq!("100 femtoseconds", format!("{}", a.with(t2)));
§Generic Parameters
N
: Unit.
Sourcepub fn into_format_args<N>(
self,
_unit: N,
style: DisplayStyle,
) -> QuantityArguments<Dimension, U, V, N>where
N: Unit,
pub fn into_format_args<N>(
self,
_unit: N,
style: DisplayStyle,
) -> QuantityArguments<Dimension, U, V, N>where
N: Unit,
Creates a struct that formats self
for display.
§Notes
Unlike format_args
, the return value of this method can be
used directly for display. It will format the value of self
for the quantity on
which it is called and nothing else.
If you wish to reuse the return value to format multiple quantities, use
format_args
instead.
§Examples
let t = Time::new::<picosecond>(1.0_E-1);
let a = t.into_format_args(femtosecond, Description);
assert_eq!("100 femtoseconds", format!("{}", a));
§Generic Parameters
N
: Unit.
Source§impl<U, V> Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = Z0, C = PInt<UInt<UTerm, B1>>>, U, V>
impl<U, V> Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = Z0, C = PInt<UInt<UTerm, B1>>>, U, V>
Sourcepub fn floor<N>(self) -> Self
pub fn floor<N>(self) -> Self
Returns the largest integer less than or equal to a number in the given measurement unit.
§Generic Parameters
N
: Unit.
Sourcepub fn ceil<N>(self) -> Self
pub fn ceil<N>(self) -> Self
Returns the smallest integer less than or equal to a number in the given measurement unit.
§Generic Parameters
N
: Unit.
Sourcepub fn round<N>(self) -> Self
pub fn round<N>(self) -> Self
Returns the nearest integer to a number in the in given measurement unit. Round half-way cases away from 0.0.
§Generic Parameters
N
: Unit.
Sourcepub fn format_args<N>(_unit: N, style: DisplayStyle) -> Arguments<Dimension, N>where
N: Unit,
pub fn format_args<N>(_unit: N, style: DisplayStyle) -> Arguments<Dimension, N>where
N: Unit,
Creates a struct that can be used to format a compatible quantity for display.
§Notes
The return value of this method cannot be used to print directly, but is instead
used to format quantities and can be reused; see
Arguments::with
and the examples below.
If you do not need to format multiple quantities, consider using
into_format_args
instead.
§Examples
let t1 = Time::new::<femtosecond>(1.0_E-1);
let t2 = Time::new::<picosecond>(1.0_E-1);
let a = Time::format_args(femtosecond, Description);
assert_eq!("0.1 femtoseconds", format!("{}", a.with(t1)));
assert_eq!("100 femtoseconds", format!("{}", a.with(t2)));
§Generic Parameters
N
: Unit.
Sourcepub fn into_format_args<N>(
self,
_unit: N,
style: DisplayStyle,
) -> QuantityArguments<Dimension, U, V, N>where
N: Unit,
pub fn into_format_args<N>(
self,
_unit: N,
style: DisplayStyle,
) -> QuantityArguments<Dimension, U, V, N>where
N: Unit,
Creates a struct that formats self
for display.
§Notes
Unlike format_args
, the return value of this method can be
used directly for display. It will format the value of self
for the quantity on
which it is called and nothing else.
If you wish to reuse the return value to format multiple quantities, use
format_args
instead.
§Examples
let t = Time::new::<picosecond>(1.0_E-1);
let a = t.into_format_args(femtosecond, Description);
assert_eq!("100 femtoseconds", format!("{}", a));
§Generic Parameters
N
: Unit.
Source§impl<U, V> Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = PInt<UInt<UTerm, B1>>, C = Z0>, U, V>
impl<U, V> Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = PInt<UInt<UTerm, B1>>, C = Z0>, U, V>
Sourcepub fn floor<N>(self) -> Self
pub fn floor<N>(self) -> Self
Returns the largest integer less than or equal to a number in the given measurement unit.
§Generic Parameters
N
: Unit.
Sourcepub fn ceil<N>(self) -> Self
pub fn ceil<N>(self) -> Self
Returns the smallest integer less than or equal to a number in the given measurement unit.
§Generic Parameters
N
: Unit.
Sourcepub fn round<N>(self) -> Self
pub fn round<N>(self) -> Self
Returns the nearest integer to a number in the in given measurement unit. Round half-way cases away from 0.0.
§Generic Parameters
N
: Unit.
Sourcepub fn format_args<N>(_unit: N, style: DisplayStyle) -> Arguments<Dimension, N>where
N: Unit,
pub fn format_args<N>(_unit: N, style: DisplayStyle) -> Arguments<Dimension, N>where
N: Unit,
Creates a struct that can be used to format a compatible quantity for display.
§Notes
The return value of this method cannot be used to print directly, but is instead
used to format quantities and can be reused; see
Arguments::with
and the examples below.
If you do not need to format multiple quantities, consider using
into_format_args
instead.
§Examples
let t1 = Time::new::<femtosecond>(1.0_E-1);
let t2 = Time::new::<picosecond>(1.0_E-1);
let a = Time::format_args(femtosecond, Description);
assert_eq!("0.1 femtoseconds", format!("{}", a.with(t1)));
assert_eq!("100 femtoseconds", format!("{}", a.with(t2)));
§Generic Parameters
N
: Unit.
Sourcepub fn into_format_args<N>(
self,
_unit: N,
style: DisplayStyle,
) -> QuantityArguments<Dimension, U, V, N>where
N: Unit,
pub fn into_format_args<N>(
self,
_unit: N,
style: DisplayStyle,
) -> QuantityArguments<Dimension, U, V, N>where
N: Unit,
Creates a struct that formats self
for display.
§Notes
Unlike format_args
, the return value of this method can be
used directly for display. It will format the value of self
for the quantity on
which it is called and nothing else.
If you wish to reuse the return value to format multiple quantities, use
format_args
instead.
§Examples
let t = Time::new::<picosecond>(1.0_E-1);
let a = t.into_format_args(femtosecond, Description);
assert_eq!("100 femtoseconds", format!("{}", a));
§Generic Parameters
N
: Unit.
Source§impl<U, V> Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = NInt<UInt<UTerm, B1>>>, U, V>
impl<U, V> Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = NInt<UInt<UTerm, B1>>>, U, V>
Sourcepub fn floor<N>(self) -> Self
pub fn floor<N>(self) -> Self
Returns the largest integer less than or equal to a number in the given measurement unit.
§Generic Parameters
N
: Unit.
Sourcepub fn ceil<N>(self) -> Self
pub fn ceil<N>(self) -> Self
Returns the smallest integer less than or equal to a number in the given measurement unit.
§Generic Parameters
N
: Unit.
Sourcepub fn round<N>(self) -> Self
pub fn round<N>(self) -> Self
Returns the nearest integer to a number in the in given measurement unit. Round half-way cases away from 0.0.
§Generic Parameters
N
: Unit.
Sourcepub fn format_args<N>(_unit: N, style: DisplayStyle) -> Arguments<Dimension, N>where
N: Unit,
pub fn format_args<N>(_unit: N, style: DisplayStyle) -> Arguments<Dimension, N>where
N: Unit,
Creates a struct that can be used to format a compatible quantity for display.
§Notes
The return value of this method cannot be used to print directly, but is instead
used to format quantities and can be reused; see
Arguments::with
and the examples below.
If you do not need to format multiple quantities, consider using
into_format_args
instead.
§Examples
let t1 = Time::new::<femtosecond>(1.0_E-1);
let t2 = Time::new::<picosecond>(1.0_E-1);
let a = Time::format_args(femtosecond, Description);
assert_eq!("0.1 femtoseconds", format!("{}", a.with(t1)));
assert_eq!("100 femtoseconds", format!("{}", a.with(t2)));
§Generic Parameters
N
: Unit.
Sourcepub fn into_format_args<N>(
self,
_unit: N,
style: DisplayStyle,
) -> QuantityArguments<Dimension, U, V, N>where
N: Unit,
pub fn into_format_args<N>(
self,
_unit: N,
style: DisplayStyle,
) -> QuantityArguments<Dimension, U, V, N>where
N: Unit,
Creates a struct that formats self
for display.
§Notes
Unlike format_args
, the return value of this method can be
used directly for display. It will format the value of self
for the quantity on
which it is called and nothing else.
If you wish to reuse the return value to format multiple quantities, use
format_args
instead.
§Examples
let t = Time::new::<picosecond>(1.0_E-1);
let a = t.into_format_args(femtosecond, Description);
assert_eq!("100 femtoseconds", format!("{}", a));
§Generic Parameters
N
: Unit.
Source§impl<U, V> Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = Z0, C = Z0>, U, V>
impl<U, V> Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = Z0, C = Z0>, U, V>
Sourcepub fn floor<N>(self) -> Self
pub fn floor<N>(self) -> Self
Returns the largest integer less than or equal to a number in the given measurement unit.
§Generic Parameters
N
: Unit.
Sourcepub fn ceil<N>(self) -> Self
pub fn ceil<N>(self) -> Self
Returns the smallest integer less than or equal to a number in the given measurement unit.
§Generic Parameters
N
: Unit.
Sourcepub fn round<N>(self) -> Self
pub fn round<N>(self) -> Self
Returns the nearest integer to a number in the in given measurement unit. Round half-way cases away from 0.0.
§Generic Parameters
N
: Unit.
Sourcepub fn format_args<N>(_unit: N, style: DisplayStyle) -> Arguments<Dimension, N>where
N: Unit,
pub fn format_args<N>(_unit: N, style: DisplayStyle) -> Arguments<Dimension, N>where
N: Unit,
Creates a struct that can be used to format a compatible quantity for display.
§Notes
The return value of this method cannot be used to print directly, but is instead
used to format quantities and can be reused; see
Arguments::with
and the examples below.
If you do not need to format multiple quantities, consider using
into_format_args
instead.
§Examples
let t1 = Time::new::<femtosecond>(1.0_E-1);
let t2 = Time::new::<picosecond>(1.0_E-1);
let a = Time::format_args(femtosecond, Description);
assert_eq!("0.1 femtoseconds", format!("{}", a.with(t1)));
assert_eq!("100 femtoseconds", format!("{}", a.with(t2)));
§Generic Parameters
N
: Unit.
Sourcepub fn into_format_args<N>(
self,
_unit: N,
style: DisplayStyle,
) -> QuantityArguments<Dimension, U, V, N>where
N: Unit,
pub fn into_format_args<N>(
self,
_unit: N,
style: DisplayStyle,
) -> QuantityArguments<Dimension, U, V, N>where
N: Unit,
Creates a struct that formats self
for display.
§Notes
Unlike format_args
, the return value of this method can be
used directly for display. It will format the value of self
for the quantity on
which it is called and nothing else.
If you wish to reuse the return value to format multiple quantities, use
format_args
instead.
§Examples
let t = Time::new::<picosecond>(1.0_E-1);
let a = t.into_format_args(femtosecond, Description);
assert_eq!("100 femtoseconds", format!("{}", a));
§Generic Parameters
N
: Unit.
Source§impl<D, U> Quantity<D, U, f64>
impl<D, U> Quantity<D, U, f64>
Sourcepub fn is_infinite(self) -> bool
pub fn is_infinite(self) -> bool
Returns true
if this value is positive infinity or negative infinity and
false
otherwise.
Source§impl<D, U, V> Quantity<D, U, V>
impl<D, U, V> Quantity<D, U, V>
Sourcepub fn classify(self) -> FpCategorywhere
V: Float,
pub fn classify(self) -> FpCategorywhere
V: Float,
Returns the floating point category of the number. If only one property is going to be tested, it is generally faster to use the specific predicate instead.
Sourcepub fn abs(self) -> Selfwhere
V: Signed,
pub fn abs(self) -> Selfwhere
V: Signed,
Computes the absolute value of self
. Returns NAN
if the quantity is
NAN
.
Sourcepub fn signum(self) -> Selfwhere
V: Signed,
pub fn signum(self) -> Selfwhere
V: Signed,
Returns a quantity that represents the sign of self
.
1.0
of the base unit if the number is positive,+0.0
, orINFINITY
.-1.0
of the base unit if the number is negative,-0.0
, orNEG_INFINITY
.NAN
if the number isNAN
.
Sourcepub fn is_sign_positive(self) -> boolwhere
V: Float,
pub fn is_sign_positive(self) -> boolwhere
V: Float,
Returns true
if self
’s sign bit is positive, including +0.0
and
INFINITY
.
Sourcepub fn is_sign_negative(self) -> boolwhere
V: Float,
pub fn is_sign_negative(self) -> boolwhere
V: Float,
Returns true
if self
’s sign is negative, including -0.0
and
NEG_INFINITY
.
Sourcepub fn recip(
self,
) -> Quantity<Q<Negate<D::M>, Negate<D::C>, Negate<D::T>>, U, V>
pub fn recip( self, ) -> Quantity<Q<Negate<D::M>, Negate<D::C>, Negate<D::T>>, U, V>
Takes the reciprocal (inverse) of a number, 1/x
.
let f: Frequency = Time::new::<second>(1.0).recip();
Source§impl Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = Z0, C = PInt<UInt<UTerm, B1>>>, dyn Units<usize, charge = e, time = s, mass = dalton>, usize>
impl Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = Z0, C = PInt<UInt<UTerm, B1>>>, dyn Units<usize, charge = e, time = s, mass = dalton>, usize>
Source§impl Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = Z0, C = PInt<UInt<UTerm, B1>>>, dyn Units<isize, charge = e, time = s, mass = dalton>, isize>
impl Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = Z0, C = PInt<UInt<UTerm, B1>>>, dyn Units<isize, charge = e, time = s, mass = dalton>, isize>
Source§impl Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = NInt<UInt<UTerm, B1>>>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>
impl Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = NInt<UInt<UTerm, B1>>>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>
Trait Implementations§
Source§impl<D, U, V> AddAssign for Quantity<D, U, V>
impl<D, U, V> AddAssign for Quantity<D, U, V>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+=
operation. Read moreSource§impl<'de, D, U, V> Deserialize<'de> for Quantity<D, U, V>
impl<'de, D, U, V> Deserialize<'de> for Quantity<D, U, V>
Source§fn deserialize<De>(deserializer: De) -> Result<Self, De::Error>where
De: Deserializer<'de>,
fn deserialize<De>(deserializer: De) -> Result<Self, De::Error>where
De: Deserializer<'de>,
Source§impl<D, U> Div<Quantity<D, U, f64>> for f64
impl<D, U> Div<Quantity<D, U, f64>> for f64
Source§impl<D, U> Div<Quantity<D, U, isize>> for isize
impl<D, U> Div<Quantity<D, U, isize>> for isize
Source§impl<D, U> Div<Quantity<D, U, usize>> for usize
impl<D, U> Div<Quantity<D, U, usize>> for usize
Source§impl<Dl, Dr, U, V> Div<Quantity<Dr, U, V>> for Quantity<Dl, U, V>where
Dl: Dimension + ?Sized,
Dl::M: Sub<Dr::M>,
<Dl::M as Sub<Dr::M>>::Output: Integer,
Dl::C: Sub<Dr::C>,
<Dl::C as Sub<Dr::C>>::Output: Integer,
Dl::T: Sub<Dr::T>,
<Dl::T as Sub<Dr::T>>::Output: Integer,
Dl::Kind: Div,
Dr: Dimension + ?Sized,
Dr::Kind: Div,
U: Units<V> + ?Sized,
V: Num + Conversion<V> + Div<V>,
impl<Dl, Dr, U, V> Div<Quantity<Dr, U, V>> for Quantity<Dl, U, V>where
Dl: Dimension + ?Sized,
Dl::M: Sub<Dr::M>,
<Dl::M as Sub<Dr::M>>::Output: Integer,
Dl::C: Sub<Dr::C>,
<Dl::C as Sub<Dr::C>>::Output: Integer,
Dl::T: Sub<Dr::T>,
<Dl::T as Sub<Dr::T>>::Output: Integer,
Dl::Kind: Div,
Dr: Dimension + ?Sized,
Dr::Kind: Div,
U: Units<V> + ?Sized,
V: Num + Conversion<V> + Div<V>,
Source§type Output = Quantity<dyn Dimension<Kind = dyn Kind, M = <<Dl as Dimension>::M as Sub<<Dr as Dimension>::M>>::Output, T = <<Dl as Dimension>::T as Sub<<Dr as Dimension>::T>>::Output, C = <<Dl as Dimension>::C as Sub<<Dr as Dimension>::C>>::Output>, U, V>
type Output = Quantity<dyn Dimension<Kind = dyn Kind, M = <<Dl as Dimension>::M as Sub<<Dr as Dimension>::M>>::Output, T = <<Dl as Dimension>::T as Sub<<Dr as Dimension>::T>>::Output, C = <<Dl as Dimension>::C as Sub<<Dr as Dimension>::C>>::Output>, U, V>
/
operator.Source§impl<D, U, V> DivAssign<V> for Quantity<D, U, V>
impl<D, U, V> DivAssign<V> for Quantity<D, U, V>
Source§fn div_assign(&mut self, rhs: V)
fn div_assign(&mut self, rhs: V)
/=
operation. Read moreSource§impl From<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = NInt<UInt<UTerm, B1>>>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for OrderedMassOverCharge
impl From<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = NInt<UInt<UTerm, B1>>>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for OrderedMassOverCharge
Source§fn from(value: MassOverCharge) -> Self
fn from(value: MassOverCharge) -> Self
Source§impl From<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for OrderedMass
impl From<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for OrderedMass
Source§impl From<Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = PInt<UInt<UTerm, B1>>, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for OrderedTime
impl From<Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = PInt<UInt<UTerm, B1>>, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for OrderedTime
Source§impl From<Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for OrderedRatio
impl From<Quantity<dyn Dimension<Kind = dyn Kind, M = Z0, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for OrderedRatio
Source§impl<D, U> Mul<Quantity<D, U, f64>> for f64
impl<D, U> Mul<Quantity<D, U, f64>> for f64
Source§impl<D, U> Mul<Quantity<D, U, isize>> for isize
impl<D, U> Mul<Quantity<D, U, isize>> for isize
Source§impl<D, U> Mul<Quantity<D, U, usize>> for usize
impl<D, U> Mul<Quantity<D, U, usize>> for usize
Source§impl<Dl, Dr, U, V> Mul<Quantity<Dr, U, V>> for Quantity<Dl, U, V>where
Dl: Dimension + ?Sized,
Dl::M: Add<Dr::M>,
<Dl::M as Add<Dr::M>>::Output: Integer,
Dl::C: Add<Dr::C>,
<Dl::C as Add<Dr::C>>::Output: Integer,
Dl::T: Add<Dr::T>,
<Dl::T as Add<Dr::T>>::Output: Integer,
Dl::Kind: Mul,
Dr: Dimension + ?Sized,
Dr::Kind: Mul,
U: Units<V> + ?Sized,
V: Num + Conversion<V> + Mul<V>,
impl<Dl, Dr, U, V> Mul<Quantity<Dr, U, V>> for Quantity<Dl, U, V>where
Dl: Dimension + ?Sized,
Dl::M: Add<Dr::M>,
<Dl::M as Add<Dr::M>>::Output: Integer,
Dl::C: Add<Dr::C>,
<Dl::C as Add<Dr::C>>::Output: Integer,
Dl::T: Add<Dr::T>,
<Dl::T as Add<Dr::T>>::Output: Integer,
Dl::Kind: Mul,
Dr: Dimension + ?Sized,
Dr::Kind: Mul,
U: Units<V> + ?Sized,
V: Num + Conversion<V> + Mul<V>,
Source§type Output = Quantity<dyn Dimension<Kind = dyn Kind, M = <<Dl as Dimension>::M as Add<<Dr as Dimension>::M>>::Output, T = <<Dl as Dimension>::T as Add<<Dr as Dimension>::T>>::Output, C = <<Dl as Dimension>::C as Add<<Dr as Dimension>::C>>::Output>, U, V>
type Output = Quantity<dyn Dimension<Kind = dyn Kind, M = <<Dl as Dimension>::M as Add<<Dr as Dimension>::M>>::Output, T = <<Dl as Dimension>::T as Add<<Dr as Dimension>::T>>::Output, C = <<Dl as Dimension>::C as Add<<Dr as Dimension>::C>>::Output>, U, V>
*
operator.Source§impl<D, U, V> MulAssign<V> for Quantity<D, U, V>
impl<D, U, V> MulAssign<V> for Quantity<D, U, V>
Source§fn mul_assign(&mut self, rhs: V)
fn mul_assign(&mut self, rhs: V)
*=
operation. Read moreSource§impl<D, U, V> PartialOrd for Quantity<D, U, V>
impl<D, U, V> PartialOrd for Quantity<D, U, V>
Source§impl<D, U, V> RemAssign for Quantity<D, U, V>
impl<D, U, V> RemAssign for Quantity<D, U, V>
Source§fn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
%=
operation. Read moreSource§impl<D, U, V> Saturating for Quantity<D, U, V>where
D: Dimension + ?Sized,
D::Kind: Saturating,
U: Units<V> + ?Sized,
V: Num + Conversion<V> + Saturating,
impl<D, U, V> Saturating for Quantity<D, U, V>where
D: Dimension + ?Sized,
D::Kind: Saturating,
U: Units<V> + ?Sized,
V: Num + Conversion<V> + Saturating,
Source§fn saturating_add(self, v: Self) -> Self
fn saturating_add(self, v: Self) -> Self
Source§fn saturating_sub(self, v: Self) -> Self
fn saturating_sub(self, v: Self) -> Self
Source§impl<D, U, V> SubAssign for Quantity<D, U, V>
impl<D, U, V> SubAssign for Quantity<D, U, V>
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-=
operation. Read moreSource§impl WithinTolerance<Multi<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>>, Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for Tolerance<OrderedMass>
impl WithinTolerance<Multi<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>>, Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for Tolerance<OrderedMass>
Source§impl WithinTolerance<Multi<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>>, Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for Tolerance<Mass>
impl WithinTolerance<Multi<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>>, Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for Tolerance<Mass>
Source§impl WithinTolerance<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = NInt<UInt<UTerm, B1>>>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>, Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = NInt<UInt<UTerm, B1>>>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for Tolerance<MassOverCharge>
impl WithinTolerance<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = NInt<UInt<UTerm, B1>>>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>, Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = NInt<UInt<UTerm, B1>>>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for Tolerance<MassOverCharge>
Source§fn within(&self, a: &MassOverCharge, b: &MassOverCharge) -> bool
fn within(&self, a: &MassOverCharge, b: &MassOverCharge) -> bool
Source§impl WithinTolerance<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>, Multi<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>>> for Tolerance<OrderedMass>
impl WithinTolerance<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>, Multi<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>>> for Tolerance<OrderedMass>
Source§impl WithinTolerance<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>, Multi<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>>> for Tolerance<Mass>
impl WithinTolerance<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>, Multi<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>>> for Tolerance<Mass>
Source§impl WithinTolerance<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>, Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for Tolerance<OrderedMass>
impl WithinTolerance<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>, Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for Tolerance<OrderedMass>
Source§impl WithinTolerance<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>, Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for Tolerance<Mass>
impl WithinTolerance<Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>, Quantity<dyn Dimension<Kind = dyn Kind, M = PInt<UInt<UTerm, B1>>, T = Z0, C = Z0>, dyn Units<f64, charge = e, time = s, mass = dalton>, f64>> for Tolerance<Mass>
impl<D, U, V> Copy for Quantity<D, U, V>
impl<D, U, V> Eq for Quantity<D, U, V>
Auto Trait Implementations§
impl<D, U, V> Freeze for Quantity<D, U, V>
impl<D, U, V> RefUnwindSafe for Quantity<D, U, V>
impl<D, U, V> Send for Quantity<D, U, V>
impl<D, U, V> Sync for Quantity<D, U, V>
impl<D, U, V> Unpin for Quantity<D, U, V>
impl<D, U, V> UnwindSafe for Quantity<D, U, V>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> HighestOf<T> for T
impl<T> HighestOf<T> for T
Source§type HighestLevel = T
type HighestLevel = T
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>
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>
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