Struct FixedPoint

Source
pub struct FixedPoint<T, const D: u8>(pub T);

Tuple Fields§

§0: T

Implementations§

Source§

impl<T, const D: u8> FixedPoint<T, D>

Source

pub fn decimal_length(self) -> u8

Source

pub fn exp(self) -> usize

Source§

impl<T, const D: u8> FixedPoint<T, D>
where T: Number + Pow<u8, Output = T> + Mul<Output = T> + Add<Output = T>,

Source

pub fn new(number: T, decimal: u8) -> Self

Source§

impl<T, const D: u8> FixedPoint<T, D>
where T: Copy + Number + Pow<u32, Output = T> + Div<Output = T> + Rem<Output = T>,

Source

pub fn integer(&self) -> T

Source

pub fn decimal(&self) -> T

Trait Implementations§

Source§

impl<T: Clone, const D: u8> Clone for FixedPoint<T, D>

Source§

fn clone(&self) -> FixedPoint<T, 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<T: Debug, const D: u8> Debug for FixedPoint<T, D>

Source§

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

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

impl<T: Default, const D: u8> Default for FixedPoint<T, D>

Source§

fn default() -> FixedPoint<T, D>

Returns the “default value” for a type. Read more
Source§

impl<T, const D: u8> Display for FixedPoint<T, D>
where T: Copy + Display + Into<i32> + PartialEq + Number + PartialOrd + Pow<u32, Output = T> + Div<Output = T> + Rem<Output = T>,

Source§

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

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

impl<T: Div<Output = T>, const D: u8> Div<T> for FixedPoint<T, D>

Source§

type Output = FixedPoint<T, D>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<T: TryFrom<isize>, const D: u8> FromStr for FixedPoint<T, D>

Source§

type Err = ()

The associated error which can be returned from parsing.
Source§

fn from_str(string: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<T: Copy + Into<i32>, const D: u8> Into<f32> for FixedPoint<T, D>

Source§

fn into(self) -> f32

Converts this type into the (usually inferred) input type.
Source§

impl<T: PartialEq, const D: u8> PartialEq for FixedPoint<T, D>

Source§

fn eq(&self, other: &FixedPoint<T, 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<T: PartialOrd, const D: u8> PartialOrd for FixedPoint<T, D>

Source§

fn partial_cmp(&self, other: &FixedPoint<T, 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<T: Copy, const D: u8> Copy for FixedPoint<T, D>

Source§

impl<T, const D: u8> StructuralPartialEq for FixedPoint<T, D>

Auto Trait Implementations§

§

impl<T, const D: u8> Freeze for FixedPoint<T, D>
where T: Freeze,

§

impl<T, const D: u8> RefUnwindSafe for FixedPoint<T, D>
where T: RefUnwindSafe,

§

impl<T, const D: u8> Send for FixedPoint<T, D>
where T: Send,

§

impl<T, const D: u8> Sync for FixedPoint<T, D>
where T: Sync,

§

impl<T, const D: u8> Unpin for FixedPoint<T, D>
where T: Unpin,

§

impl<T, const D: u8> UnwindSafe for FixedPoint<T, D>
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§

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.