multiversx_sc::types

Trait Decimals

Source
pub trait Decimals {
    // Required method
    fn num_decimals(&self) -> NumDecimals;

    // Provided method
    fn scaling_factor<M: ManagedTypeApi>(
        &self,
    ) -> ManagedRef<'static, M, BigUint<M>> { ... }
}
Expand description

Implemented by all decimal types usable in ManagedDecimal.

Required Methods§

Source

fn num_decimals(&self) -> NumDecimals

Number of decimals as variable.

Provided Methods§

Source

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

10^num_decimals, represented as a BigUint.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Decimals for NumDecimals

Source§

impl<const DECIMALS: NumDecimals> Decimals for ConstDecimals<DECIMALS>