ConstDecimals

Struct ConstDecimals 

Source
pub struct ConstDecimals<DECIMALS: Unsigned> { /* private fields */ }
Expand description

Zero-sized constant number of decimals.

Ideal if the number of decimals is known at compile time.

Implementations§

Source§

impl<DECIMALS: Unsigned> ConstDecimals<DECIMALS>

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl<DEC1, DEC2> Add<ConstDecimals<DEC2>> for ConstDecimals<DEC1>
where DEC1: Unsigned + Add<DEC2>, DEC2: Unsigned, <DEC1 as Add<DEC2>>::Output: Unsigned,

Source§

type Output = ConstDecimals<<DEC1 as Add<DEC2>>::Output>

The resulting type after applying the + operator.
Source§

fn add(self, _rhs: ConstDecimals<DEC2>) -> Self::Output

Performs the + operation. Read more
Source§

impl<DECIMALS: Clone + Unsigned> Clone for ConstDecimals<DECIMALS>

Source§

fn clone(&self) -> ConstDecimals<DECIMALS>

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<DECIMALS: Debug + Unsigned> Debug for ConstDecimals<DECIMALS>

Source§

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

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

impl<DECIMALS: Unsigned> Decimals for ConstDecimals<DECIMALS>

Source§

fn num_decimals(&self) -> NumDecimals

Number of decimals as variable.
Source§

fn scaling_factor<M: ManagedTypeApi>( &self, ) -> ManagedRef<'static, M, BigUint<M>>

10^num_decimals, represented as a BigUint.
Source§

impl<DECIMALS: Default + Unsigned> Default for ConstDecimals<DECIMALS>

Source§

fn default() -> ConstDecimals<DECIMALS>

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

impl<DEC1, DEC2> Sub<ConstDecimals<DEC2>> for ConstDecimals<DEC1>
where DEC1: Unsigned + Sub<DEC2>, DEC2: Unsigned, <DEC1 as Sub<DEC2>>::Output: Unsigned,

Source§

type Output = ConstDecimals<<DEC1 as Sub<DEC2>>::Output>

The resulting type after applying the - operator.
Source§

fn sub(self, _rhs: ConstDecimals<DEC2>) -> Self::Output

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<DECIMALS> Freeze for ConstDecimals<DECIMALS>

§

impl<DECIMALS> RefUnwindSafe for ConstDecimals<DECIMALS>
where DECIMALS: RefUnwindSafe,

§

impl<DECIMALS> Send for ConstDecimals<DECIMALS>
where DECIMALS: Send,

§

impl<DECIMALS> Sync for ConstDecimals<DECIMALS>
where DECIMALS: Sync,

§

impl<DECIMALS> Unpin for ConstDecimals<DECIMALS>
where DECIMALS: Unpin,

§

impl<DECIMALS> UnwindSafe for ConstDecimals<DECIMALS>
where DECIMALS: 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> 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.