[−][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]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self
[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]
Deserializes as a base64 string
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]
type Err = StdError
The associated error which can be returned from parsing.
fn from_str(input: &str) -> Result<Self, Self::Err>
[src]
Converts the decimal string to a Decimal Possible inputs: "1.23", "1", "000012", "1.123000000" Disallowed: "", ".23"
This never performs any kind of rounding. More than 18 fractional digits, even zeros, result in an error.
impl JsonSchema for Decimal
[src]
fn schema_name() -> String
[src]
fn json_schema(gen: &mut SchemaGenerator) -> Schema
[src]
fn is_referenceable() -> bool
[src]
impl Mul<Decimal> for Uint128
[src]
Both du and ud with d: Decimal and u: Uint128 returns an Uint128. There is no specific reason for this decision other than the initial use cases we have. If you need a Decimal result for the same calculation, use Decimal(du) or Decimal(ud).
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: Decimal) -> Self::Output
[src]
impl Mul<Uint128> for Decimal
[src]
type Output = Uint128
The resulting type after applying the *
operator.
fn mul(self, rhs: Uint128) -> Self::Output
[src]
impl Ord for Decimal
[src]
fn cmp(&self, other: &Decimal) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Decimal> for Decimal
[src]
impl PartialOrd<Decimal> for Decimal
[src]
fn partial_cmp(&self, other: &Decimal) -> Option<Ordering>
[src]
fn lt(&self, other: &Decimal) -> bool
[src]
fn le(&self, other: &Decimal) -> bool
[src]
fn gt(&self, other: &Decimal) -> bool
[src]
fn ge(&self, other: &Decimal) -> bool
[src]
impl Serialize for Decimal
[src]
Serializes as a decimal string
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,
fn borrow_mut(&mut self) -> &mut T
[src]
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,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,