Skip to main content

Rate

Struct Rate 

Source
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>

Source

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.

Source

pub fn from_qty_vals(term: TQ, per: PQ) -> Self

Returns a new instance of Rate with attributes extracted from the given quantity values.

Source

pub const fn term_amount(&self) -> AmountT

Returns the term amount of self.

Source

pub const fn term_unit(&self) -> TQ::UnitType

Returns the term unit of self.

Source

pub const fn per_unit_multiple(&self) -> AmountT

Returns the per unit multiple of self.

Source

pub const fn per_unit(&self) -> PQ::UnitType

Returns the per unit of self.

Source

pub const fn reciprocal(&self) -> Rate<PQ, TQ>

Returns the multiplicative inverse of self

Trait Implementations§

Source§

impl<TQ: Clone + Quantity, PQ: Clone + Quantity> Clone for Rate<TQ, PQ>
where TQ::UnitType: Clone, PQ::UnitType: Clone,

Source§

fn clone(&self) -> Rate<TQ, PQ>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<TQ: Debug + Quantity, PQ: Debug + Quantity> Debug for Rate<TQ, PQ>
where TQ::UnitType: Debug, PQ::UnitType: Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<TQ: Quantity, PQ: Quantity> Display for Rate<TQ, PQ>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<PQ: Quantity> Div<Rate<Acceleration, PQ>> for Acceleration

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<Area, PQ>> for Area

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<DataThroughput, PQ>> for DataThroughput

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<DataVolume, PQ>> for DataVolume

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<Duration, PQ>> for Duration

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<Energy, PQ>> for Energy

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<Force, PQ>> for Force

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<Frequency, PQ>> for Frequency

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<Length, PQ>> for Length

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<Mass, PQ>> for Mass

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<Power, PQ>> for Power

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<Speed, PQ>> for Speed

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<Temperature, PQ>> for Temperature

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<PQ: Quantity> Div<Rate<Volume, PQ>> for Volume

Source§

type Output = PQ

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Rate<Self, PQ>) -> Self::Output

Performs the / operation. Read more
Source§

impl<TQ: Quantity, PQ> Mul<PQ> for Rate<TQ, PQ>
where PQ: Div<PQ, Output = AmountT> + Quantity,

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, Acceleration>> for Acceleration

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, Area>> for Area

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, DataThroughput>> for DataThroughput

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, DataVolume>> for DataVolume

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, Duration>> for Duration

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, Energy>> for Energy

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, Force>> for Force

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, Frequency>> for Frequency

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, Length>> for Length

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, Mass>> for Mass

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, Power>> for Power

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, Speed>> for Speed

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, Temperature>> for Temperature

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Quantity> Mul<Rate<TQ, Volume>> for Volume

Source§

type Output = TQ

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Rate<TQ, Self>) -> Self::Output

Performs the * operation. Read more
Source§

impl<TQ: Copy + Quantity, PQ: Copy + Quantity> Copy for Rate<TQ, PQ>
where TQ::UnitType: Copy, PQ::UnitType: Copy,

Auto Trait Implementations§

§

impl<TQ, PQ> Freeze for Rate<TQ, PQ>
where <TQ as Quantity>::UnitType: Freeze, <PQ as Quantity>::UnitType: Freeze,

§

impl<TQ, PQ> RefUnwindSafe for Rate<TQ, PQ>

§

impl<TQ, PQ> Send for Rate<TQ, PQ>
where <TQ as Quantity>::UnitType: Send, <PQ as Quantity>::UnitType: Send,

§

impl<TQ, PQ> Sync for Rate<TQ, PQ>
where <TQ as Quantity>::UnitType: Sync, <PQ as Quantity>::UnitType: Sync,

§

impl<TQ, PQ> Unpin for Rate<TQ, PQ>
where <TQ as Quantity>::UnitType: Unpin, <PQ as Quantity>::UnitType: Unpin,

§

impl<TQ, PQ> UnwindSafe for Rate<TQ, PQ>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.