pub struct Fixed<T, const DECIMALS: u8>(/* private fields */);
Expand description
Fixed-point decimal type.
Implementations§
Source§impl<T, const DECIMALS: u8> Fixed<T, DECIMALS>
impl<T, const DECIMALS: u8> Fixed<T, DECIMALS>
Sourcepub fn from_inner(inner: T) -> Self
pub fn from_inner(inner: T) -> Self
Create a new decimal from the inner representation.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Get the inner value.
Trait Implementations§
Source§impl<T: FixedPointOps<DECIMALS>, const DECIMALS: u8> CheckedAdd for Fixed<T, DECIMALS>
impl<T: FixedPointOps<DECIMALS>, const DECIMALS: u8> CheckedAdd for Fixed<T, DECIMALS>
Source§fn checked_add(&self, v: &Self) -> Option<Self>
fn checked_add(&self, v: &Self) -> Option<Self>
Adds two numbers, checking for overflow. If overflow happens,
None
is
returned.Source§impl<T: FixedPointOps<DECIMALS>, const DECIMALS: u8> CheckedMul for Fixed<T, DECIMALS>
impl<T: FixedPointOps<DECIMALS>, const DECIMALS: u8> CheckedMul for Fixed<T, DECIMALS>
Source§fn checked_mul(&self, v: &Self) -> Option<Self>
fn checked_mul(&self, v: &Self) -> Option<Self>
Multiplies two numbers, checking for underflow or overflow. If underflow
or overflow happens,
None
is returned.Source§impl<T: FixedPointOps<DECIMALS>, const DECIMALS: u8> One for Fixed<T, DECIMALS>
impl<T: FixedPointOps<DECIMALS>, const DECIMALS: u8> One for Fixed<T, DECIMALS>
Source§impl<T: Ord, const DECIMALS: u8> Ord for Fixed<T, DECIMALS>
impl<T: Ord, const DECIMALS: u8> Ord for Fixed<T, DECIMALS>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd, const DECIMALS: u8> PartialOrd for Fixed<T, DECIMALS>
impl<T: PartialOrd, const DECIMALS: u8> PartialOrd for Fixed<T, DECIMALS>
impl<T: Copy, const DECIMALS: u8> Copy for Fixed<T, DECIMALS>
impl<T: Eq, const DECIMALS: u8> Eq for Fixed<T, DECIMALS>
impl<T, const DECIMALS: u8> StructuralPartialEq for Fixed<T, DECIMALS>
Auto Trait Implementations§
impl<T, const DECIMALS: u8> Freeze for Fixed<T, DECIMALS>where
T: Freeze,
impl<T, const DECIMALS: u8> RefUnwindSafe for Fixed<T, DECIMALS>where
T: RefUnwindSafe,
impl<T, const DECIMALS: u8> Send for Fixed<T, DECIMALS>where
T: Send,
impl<T, const DECIMALS: u8> Sync for Fixed<T, DECIMALS>where
T: Sync,
impl<T, const DECIMALS: u8> Unpin for Fixed<T, DECIMALS>where
T: Unpin,
impl<T, const DECIMALS: u8> UnwindSafe for Fixed<T, DECIMALS>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more