[−][src]Struct cosmwasm_bignumber::Decimal256
A fixed-point decimal value with 18 fractional digits, i.e. Decimal256(1_000_000_000_000_000_000) == 1.0 The greatest possible value that can be represented is 115792089237316195423570985008687907853269984665640564039457.584007913129639935 (which is (2^128 - 1) / 10^18)
Implementations
impl Decimal256
[src]
pub const MAX: Decimal256
[src]
pub const DECIMAL_FRACTIONAL: U256
[src]
pub const fn one() -> Decimal256
[src]
Create a 1.0 Decimal256
pub const fn zero() -> Decimal256
[src]
Create a 0.0 Decimal256
pub fn percent(x: u64) -> Decimal256
[src]
Convert x% into Decimal256
pub fn permille(x: u64) -> Decimal256
[src]
Convert permille (x/1000) into Decimal256
pub fn from_ratio<A: Into<U256>, B: Into<U256>>(
nominator: A,
denominator: B
) -> Decimal256
[src]
nominator: A,
denominator: B
) -> Decimal256
Returns the ratio (nominator / denominator) as a Decimal256
pub fn from_uint256<A: Into<Uint256>>(val: A) -> Decimal256
[src]
pub fn is_zero(&self) -> bool
[src]
Trait Implementations
impl Add<Decimal256> for Decimal256
[src]
type Output = Self
The resulting type after applying the +
operator.
pub fn add(self, rhs: Self) -> Self
[src]
impl AddAssign<Decimal256> for Decimal256
[src]
pub fn add_assign(&mut self, rhs: Self)
[src]
impl Clone for Decimal256
[src]
pub fn clone(&self) -> Decimal256
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Decimal256
[src]
impl Debug for Decimal256
[src]
impl Default for Decimal256
[src]
pub fn default() -> Decimal256
[src]
impl<'de> Deserialize<'de> for Decimal256
[src]
Deserializes as a base64 string
pub fn deserialize<D>(deserializer: D) -> Result<Decimal256, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for Decimal256
[src]
impl Div<Decimal256> for Decimal256
[src]
type Output = Self
The resulting type after applying the /
operator.
pub fn div(self, rhs: Self) -> Self
[src]
impl Div<Decimal256> for Uint256
[src]
type Output = Self
The resulting type after applying the /
operator.
pub fn div(self, rhs: Decimal256) -> Self::Output
[src]
impl Eq for Decimal256
[src]
impl From<Decimal> for Decimal256
[src]
impl FromStr for Decimal256
[src]
type Err = StdError
The associated error which can be returned from parsing.
pub fn from_str(input: &str) -> Result<Self, Self::Err>
[src]
Converts the decimal string to a Decimal256 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 Into<Decimal> for Decimal256
[src]
impl JsonSchema for Decimal256
[src]
pub fn schema_name() -> String
[src]
pub fn json_schema(gen: &mut SchemaGenerator) -> Schema
[src]
pub fn is_referenceable() -> bool
[src]
impl Mul<Decimal256> for Decimal256
[src]
type Output = Self
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Self) -> Self
[src]
impl Mul<Decimal256> for Uint256
[src]
Both du and ud with d: Decimal256 and u: Uint256 returns an Uint256. There is no specific reason for this decision other than the initial use cases we have. If you need a Decimal256 result for the same calculation, use Decimal256(du) or Decimal256(ud).
type Output = Self
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Decimal256) -> Self::Output
[src]
impl Mul<Uint256> for Decimal256
[src]
type Output = Uint256
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Uint256) -> Self::Output
[src]
impl Ord for Decimal256
[src]
pub fn cmp(&self, other: &Decimal256) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Decimal256> for Decimal256
[src]
pub fn eq(&self, other: &Decimal256) -> bool
[src]
pub fn ne(&self, other: &Decimal256) -> bool
[src]
impl PartialOrd<Decimal256> for Decimal256
[src]
pub fn partial_cmp(&self, other: &Decimal256) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Decimal256) -> bool
[src]
pub fn le(&self, other: &Decimal256) -> bool
[src]
pub fn gt(&self, other: &Decimal256) -> bool
[src]
pub fn ge(&self, other: &Decimal256) -> bool
[src]
impl Serialize for Decimal256
[src]
Serializes as a decimal string
impl StructuralEq for Decimal256
[src]
impl StructuralPartialEq for Decimal256
[src]
impl Sub<Decimal256> for Decimal256
[src]
Auto Trait Implementations
impl RefUnwindSafe for Decimal256
impl Send for Decimal256
impl Sync for Decimal256
impl Unpin for Decimal256
impl UnwindSafe for Decimal256
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,