Struct embassy_hal_internal::ratio::Ratio

source ·
pub struct Ratio<T> { /* private fields */ }
Expand description

Represents the ratio between two numbers.

Implementations§

source§

impl<T> Ratio<T>

source

pub const fn new_raw(numer: T, denom: T) -> Ratio<T>

Creates a new Ratio.

source

pub const fn numer(&self) -> &T

Gets an immutable reference to the numerator.

source

pub const fn denom(&self) -> &T

Gets an immutable reference to the denominator.

source§

impl<T: CheckedDiv> Ratio<T>

source

pub fn to_integer(&self) -> T

Converts to an integer, rounding towards zero.

Trait Implementations§

source§

impl<T: CheckedMul + CheckedAdd> Add<T> for Ratio<T>

§

type Output = Ratio<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
source§

impl<T: Clone> Clone for Ratio<T>

source§

fn clone(&self) -> Ratio<T>

Returns a copy 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<T: Debug> Debug for Ratio<T>

source§

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

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

impl<T: Display> Display for Ratio<T>

source§

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

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

impl<T: CheckedMul> Div<T> for Ratio<T>

§

type Output = Ratio<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
source§

impl From<Ratio<i128>> for f32

source§

fn from(r: Ratio<i128>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<i128>> for f64

source§

fn from(r: Ratio<i128>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<i16>> for f32

source§

fn from(r: Ratio<i16>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<i16>> for f64

source§

fn from(r: Ratio<i16>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<i32>> for f32

source§

fn from(r: Ratio<i32>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<i32>> for f64

source§

fn from(r: Ratio<i32>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<i64>> for f32

source§

fn from(r: Ratio<i64>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<i64>> for f64

source§

fn from(r: Ratio<i64>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<i8>> for f32

source§

fn from(r: Ratio<i8>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<i8>> for f64

source§

fn from(r: Ratio<i8>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<u128>> for f32

source§

fn from(r: Ratio<u128>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<u128>> for f64

source§

fn from(r: Ratio<u128>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<u16>> for f32

source§

fn from(r: Ratio<u16>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<u16>> for f64

source§

fn from(r: Ratio<u16>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<u32>> for f32

source§

fn from(r: Ratio<u32>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<u32>> for f64

source§

fn from(r: Ratio<u32>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<u64>> for f32

source§

fn from(r: Ratio<u64>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<u64>> for f64

source§

fn from(r: Ratio<u64>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<u8>> for f32

source§

fn from(r: Ratio<u8>) -> Self

Converts to this type from the input type.
source§

impl From<Ratio<u8>> for f64

source§

fn from(r: Ratio<u8>) -> Self

Converts to this type from the input type.
source§

impl<T: CheckedMul> Mul<T> for Ratio<T>

§

type Output = Ratio<T>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<T: Copy> Copy for Ratio<T>

Auto Trait Implementations§

§

impl<T> Freeze for Ratio<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Ratio<T>
where T: RefUnwindSafe,

§

impl<T> Send for Ratio<T>
where T: Send,

§

impl<T> Sync for Ratio<T>
where T: Sync,

§

impl<T> Unpin for Ratio<T>
where T: Unpin,

§

impl<T> UnwindSafe for Ratio<T>
where T: UnwindSafe,

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

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

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.