[−][src]Struct cosmwasm_std::Decimal
A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0
The greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)
Implementations
impl Decimal
[src][−]
pub const MAX: Decimal
[src]
pub const fn one() -> Decimal
[src][−]
Create a 1.0 Decimal
pub const fn zero() -> Decimal
[src][−]
Create a 0.0 Decimal
pub fn percent(x: u64) -> Decimal
[src][−]
Convert x% into Decimal
pub fn permille(x: u64) -> Decimal
[src][−]
Convert permille (x/1000) into Decimal
pub fn from_ratio<A: Into<u128>, B: Into<u128>>(
nominator: A,
denominator: B
) -> Decimal
[src][−]
nominator: A,
denominator: B
) -> Decimal
Returns the ratio (nominator / denominator) as a Decimal
pub fn is_zero(&self) -> bool
[src]
Trait Implementations
impl Add<Decimal> for Decimal
[src][+]
impl Clone for Decimal
[src][+]
impl Copy for Decimal
[src]
impl Debug for Decimal
[src][+]
impl Default for Decimal
[src][+]
impl<'de> Deserialize<'de> for Decimal
[src][+]
fn deserialize<D>(deserializer: D) -> Result<Decimal, D::Error> where
D: Deserializer<'de>,
[src][−]
D: Deserializer<'de>,
impl Display for Decimal
[src][+]
impl Eq for Decimal
[src]
impl FromStr for Decimal
[src][+]
impl JsonSchema for Decimal
[src][+]
impl Mul<Decimal> for Uint128
[src][+]
impl Mul<Uint128> for Decimal
[src][+]
impl Ord for Decimal
[src][+]
impl PartialEq<Decimal> for Decimal
[src][+]
impl PartialOrd<Decimal> for Decimal
[src][+]
impl Serialize for Decimal
[src][+]
impl StructuralEq for Decimal
[src]
impl StructuralPartialEq for Decimal
[src]
Auto Trait Implementations
impl RefUnwindSafe for Decimal
impl Send for Decimal
impl Sync for Decimal
impl Unpin for Decimal
impl UnwindSafe for Decimal
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src][+]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,