Struct cosmwasm_std::Uint128 [−][src]
pub struct Uint128(_);
Expand description
A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.
Examples
Use from
to create instances of this and u128
to get the value out:
let a = Uint128::from(123u128); assert_eq!(a.u128(), 123); let b = Uint128::from(42u64); assert_eq!(b.u128(), 42); let c = Uint128::from(70u32); assert_eq!(c.u128(), 70);
Implementations
Creates a Uint128(value).
This method is less flexible than from
but can be called in a const context.
Trait Implementations
Performs the +=
operation. Read more
Performs the +=
operation. Read more
Deserialized from an integer string using base 10
Performs the /=
operation. Read more
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).
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Performs the -=
operation. Read more
Performs the -=
operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for Uint128
impl UnwindSafe for Uint128
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self
impl<T, Rhs, Output> GroupOps<Rhs, Output> for T where
T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>,
impl<T, Rhs, Output> GroupOpsOwned<Rhs, Output> for T where
T: for<'r> GroupOps<&'r Rhs, Output>,