pub struct Rate<TQ: Quantity, PQ: Quantity> { /* private fields */ }Expand description
The ratio between two related quantity values.
Implementations§
Source§impl<TQ: Quantity, PQ: Quantity> Rate<TQ, PQ>
impl<TQ: Quantity, PQ: Quantity> Rate<TQ, PQ>
Sourcepub const fn new(
term_amount: AmountT,
term_unit: TQ::UnitType,
per_unit_multiple: AmountT,
per_unit: PQ::UnitType,
) -> Self
pub const fn new( term_amount: AmountT, term_unit: TQ::UnitType, per_unit_multiple: AmountT, per_unit: PQ::UnitType, ) -> Self
Returns a new instance of Rate with attributes equal to given params.
Sourcepub fn from_qty_vals(term: TQ, per: PQ) -> Self
pub fn from_qty_vals(term: TQ, per: PQ) -> Self
Returns a new instance of Rate with attributes extracted from the
given quantity values.
Sourcepub const fn term_amount(&self) -> AmountT
pub const fn term_amount(&self) -> AmountT
Returns the term amount of self.
Sourcepub const fn per_unit_multiple(&self) -> AmountT
pub const fn per_unit_multiple(&self) -> AmountT
Returns the per unit multiple of self.
Sourcepub const fn reciprocal(&self) -> Rate<PQ, TQ>
pub const fn reciprocal(&self) -> Rate<PQ, TQ>
Returns the multiplicative inverse of self
Trait Implementations§
Source§impl<PQ: Quantity> Div<Rate<Acceleration, PQ>> for Acceleration
impl<PQ: Quantity> Div<Rate<Acceleration, PQ>> for Acceleration
Source§impl<PQ: Quantity> Div<Rate<DataThroughput, PQ>> for DataThroughput
impl<PQ: Quantity> Div<Rate<DataThroughput, PQ>> for DataThroughput
Source§impl<PQ: Quantity> Div<Rate<DataVolume, PQ>> for DataVolume
impl<PQ: Quantity> Div<Rate<DataVolume, PQ>> for DataVolume
Source§impl<PQ: Quantity> Div<Rate<Temperature, PQ>> for Temperature
impl<PQ: Quantity> Div<Rate<Temperature, PQ>> for Temperature
Source§impl<TQ: Quantity> Mul<Rate<TQ, Acceleration>> for Acceleration
impl<TQ: Quantity> Mul<Rate<TQ, Acceleration>> for Acceleration
Source§impl<TQ: Quantity> Mul<Rate<TQ, DataThroughput>> for DataThroughput
impl<TQ: Quantity> Mul<Rate<TQ, DataThroughput>> for DataThroughput
Source§impl<TQ: Quantity> Mul<Rate<TQ, DataVolume>> for DataVolume
impl<TQ: Quantity> Mul<Rate<TQ, DataVolume>> for DataVolume
Source§impl<TQ: Quantity> Mul<Rate<TQ, Temperature>> for Temperature
impl<TQ: Quantity> Mul<Rate<TQ, Temperature>> for Temperature
impl<TQ: Copy + Quantity, PQ: Copy + Quantity> Copy for Rate<TQ, PQ>
Auto Trait Implementations§
impl<TQ, PQ> Freeze for Rate<TQ, PQ>
impl<TQ, PQ> RefUnwindSafe for Rate<TQ, PQ>
impl<TQ, PQ> Send for Rate<TQ, PQ>
impl<TQ, PQ> Sync for Rate<TQ, PQ>
impl<TQ, PQ> Unpin for Rate<TQ, PQ>
impl<TQ, PQ> UnsafeUnpin for Rate<TQ, PQ>
impl<TQ, PQ> UnwindSafe for Rate<TQ, PQ>
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