Skip to main content

Per

Struct Per 

Source
pub struct Per<N: Unit, D: Unit>(/* private fields */);
Expand description

Unit representing the division of two other units.

Per<N, D> corresponds to N / D and carries both the dimensional information and the scaling ratio between the constituent units. It is generic over any numerator and denominator units, which allows implementing arithmetic generically for all pairs without bespoke macros.

Trait Implementations§

Source§

impl<N: Clone + Unit, D: Clone + Unit> Clone for Per<N, D>

Source§

fn clone(&self) -> Per<N, D>

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<N: Debug + Unit, D: Debug + Unit> Debug for Per<N, D>

Source§

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

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

impl<N: PartialEq + Unit, D: PartialEq + Unit> PartialEq for Per<N, D>

Source§

fn eq(&self, other: &Per<N, D>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<N: PartialOrd + Unit, D: PartialOrd + Unit> PartialOrd for Per<N, D>

Source§

fn partial_cmp(&self, other: &Per<N, D>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<N: Unit, D: Unit> Unit for Per<N, D>
where N::Dim: DimDiv<D::Dim>, <N::Dim as DimDiv<D::Dim>>::Output: Dimension,

Source§

const RATIO: f64

Unit-to-canonical conversion factor.
Source§

const SYMBOL: &'static str = ""

Printable symbol, shown by core::fmt::Display.
Source§

type Dim = <<N as Unit>::Dim as DimDiv<<D as Unit>::Dim>>::Output

Dimension to which this unit belongs.
Source§

impl<N: Copy + Unit, D: Copy + Unit> Copy for Per<N, D>

Source§

impl<N: Unit, D: Unit> StructuralPartialEq for Per<N, D>

Auto Trait Implementations§

§

impl<N, D> Freeze for Per<N, D>

§

impl<N, D> RefUnwindSafe for Per<N, D>

§

impl<N, D> Send for Per<N, D>
where N: Send, D: Send,

§

impl<N, D> Sync for Per<N, D>
where N: Sync, D: Sync,

§

impl<N, D> Unpin for Per<N, D>
where N: Unpin, D: Unpin,

§

impl<N, D> UnwindSafe for Per<N, D>
where N: UnwindSafe, D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> AngularUnit for T
where T: Unit<Dim = Dim<Z0, Z0, Z0, Z0, Z0, Z0, Z0, PInt<UInt<UTerm, B1>>>>,

Source§

const FULL_TURN: f64 = const FULL_TURN: f64 = Radians::new(TAU).to_const::<T>().value();

One full revolution (360°) expressed in T unit.

Source§

const HALF_TURN: f64 = const HALF_TURN: f64 = Radians::new(TAU).to_const::<T>().value() * 0.5;

Half a revolution (180°) expressed in T unit.

Source§

const QUARTED_TURN: f64 = const QUARTED_TURN: f64 = Radians::new(TAU).to_const::<T>().value() * 0.25;

Quarter revolution (90°) expressed in T unit.

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> Same for T

Source§

type Output = T

Should always be Self
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, 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.
Source§

impl<T> AreaUnit for T
where T: Unit<Dim = Dim<PInt<UInt<UInt<UTerm, B1>, B0>>, Z0, Z0, Z0, Z0, Z0, Z0, Z0>>,

Source§

impl<T> FrequencyUnit for T
where T: Unit<Dim = Dim<Z0, NInt<UInt<UTerm, B1>>, Z0, Z0, Z0, Z0, Z0, PInt<UInt<UTerm, B1>>>>,

Source§

impl<T> LengthUnit for T
where T: Unit<Dim = Dim<PInt<UInt<UTerm, B1>>, Z0, Z0, Z0, Z0, Z0, Z0, Z0>>,

Source§

impl<T> MassUnit for T
where T: Unit<Dim = Dim<Z0, Z0, PInt<UInt<UTerm, B1>>, Z0, Z0, Z0, Z0, Z0>>,

Source§

impl<T> PowerUnit for T
where T: Unit<Dim = Dim<PInt<UInt<UInt<UTerm, B1>, B0>>, NInt<UInt<UInt<UTerm, B1>, B1>>, PInt<UInt<UTerm, B1>>, Z0, Z0, Z0, Z0, Z0>>,

Source§

impl<T> TimeUnit for T
where T: Unit<Dim = Dim<Z0, PInt<UInt<UTerm, B1>>, Z0, Z0, Z0, Z0, Z0, Z0>>,

Source§

impl<T> VelocityUnit for T
where T: Unit<Dim = Dim<PInt<UInt<UTerm, B1>>, NInt<UInt<UTerm, B1>>, Z0, Z0, Z0, Z0, Z0, Z0>>,

Source§

impl<T> VolumeUnit for T
where T: Unit<Dim = Dim<PInt<UInt<UInt<UTerm, B1>, B1>>, Z0, Z0, Z0, Z0, Z0, Z0, Z0>>,