Struct cosmwasm_std::Uint64
source · [−]pub struct Uint64(_);
Expand description
A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 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 u64
to get the value out:
let a = Uint64::from(42u64);
assert_eq!(a.u64(), 42);
let b = Uint64::from(70u32);
assert_eq!(b.u64(), 70);
Implementations
sourceimpl Uint64
impl Uint64
pub const MAX: Self = _
pub const MIN: Self = _
sourcepub const fn new(value: u64) -> Self
pub const fn new(value: u64) -> Self
Creates a Uint64(value).
This method is less flexible than from
but can be called in a const context.
sourcepub const fn to_be_bytes(self) -> [u8; 8]
pub const fn to_be_bytes(self) -> [u8; 8]
Returns a copy of the number as big endian bytes.
sourcepub const fn to_le_bytes(self) -> [u8; 8]
pub const fn to_le_bytes(self) -> [u8; 8]
Returns a copy of the number as little endian bytes.
pub const fn is_zero(&self) -> bool
pub fn pow(self, exp: u32) -> Self
sourcepub fn multiply_ratio<A: Into<u64>, B: Into<u64>>(
&self,
numerator: A,
denominator: B
) -> Uint64
pub fn multiply_ratio<A: Into<u64>, B: Into<u64>>(
&self,
numerator: A,
denominator: B
) -> Uint64
Returns self * numerator / denominator
sourcepub fn checked_multiply_ratio<A: Into<u64>, B: Into<u64>>(
&self,
numerator: A,
denominator: B
) -> Result<Uint64, CheckedMultiplyRatioError>
pub fn checked_multiply_ratio<A: Into<u64>, B: Into<u64>>(
&self,
numerator: A,
denominator: B
) -> Result<Uint64, CheckedMultiplyRatioError>
Returns self * numerator / denominator
pub fn checked_add(self, other: Self) -> Result<Self, OverflowError>
pub fn checked_sub(self, other: Self) -> Result<Self, OverflowError>
pub fn checked_mul(self, other: Self) -> Result<Self, OverflowError>
pub fn checked_pow(self, exp: u32) -> Result<Self, OverflowError>
pub fn checked_div(self, other: Self) -> Result<Self, DivideByZeroError>
pub fn checked_div_euclid(self, other: Self) -> Result<Self, DivideByZeroError>
pub fn checked_rem(self, other: Self) -> Result<Self, DivideByZeroError>
pub fn wrapping_add(self, other: Self) -> Self
pub fn wrapping_sub(self, other: Self) -> Self
pub fn wrapping_mul(self, other: Self) -> Self
pub fn wrapping_pow(self, other: u32) -> Self
pub fn saturating_add(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_mul(self, other: Self) -> Self
pub fn saturating_pow(self, exp: u32) -> Self
pub const fn abs_diff(self, other: Self) -> Self
Trait Implementations
sourceimpl<'a> AddAssign<&'a Uint64> for Uint64
impl<'a> AddAssign<&'a Uint64> for Uint64
sourcefn add_assign(&mut self, rhs: &'a Uint64)
fn add_assign(&mut self, rhs: &'a Uint64)
Performs the
+=
operation. Read moresourceimpl AddAssign<Uint64> for Uint64
impl AddAssign<Uint64> for Uint64
sourcefn add_assign(&mut self, rhs: Uint64)
fn add_assign(&mut self, rhs: Uint64)
Performs the
+=
operation. Read moresourceimpl<'de> Deserialize<'de> for Uint64
impl<'de> Deserialize<'de> for Uint64
sourcefn deserialize<D>(deserializer: D) -> Result<Uint64, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Uint64, D::Error>where
D: Deserializer<'de>,
Deserialized from an integer string using base 10
sourceimpl<'a> DivAssign<&'a Uint64> for Uint64
impl<'a> DivAssign<&'a Uint64> for Uint64
sourcefn div_assign(&mut self, rhs: &'a Uint64)
fn div_assign(&mut self, rhs: &'a Uint64)
Performs the
/=
operation. Read moresourceimpl DivAssign<Uint64> for Uint64
impl DivAssign<Uint64> for Uint64
sourcefn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/=
operation. Read moresourceimpl JsonSchema for Uint64
impl JsonSchema for Uint64
sourcefn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
sourcefn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
sourcefn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresourceimpl MulAssign<&Uint64> for Uint64
impl MulAssign<&Uint64> for Uint64
sourcefn mul_assign(&mut self, other: &Uint64)
fn mul_assign(&mut self, other: &Uint64)
Performs the
*=
operation. Read moresourceimpl MulAssign<Uint64> for Uint64
impl MulAssign<Uint64> for Uint64
sourcefn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moresourceimpl Ord for Uint64
impl Ord for Uint64
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<Uint64> for Uint64
impl PartialOrd<Uint64> for Uint64
sourcefn partial_cmp(&self, other: &Uint64) -> Option<Ordering>
fn partial_cmp(&self, other: &Uint64) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresourceimpl RemAssign<&Uint64> for Uint64
impl RemAssign<&Uint64> for Uint64
sourcefn rem_assign(&mut self, other: &Uint64)
fn rem_assign(&mut self, other: &Uint64)
Performs the
%=
operation. Read moresourceimpl RemAssign<Uint64> for Uint64
impl RemAssign<Uint64> for Uint64
sourcefn rem_assign(&mut self, rhs: Uint64)
fn rem_assign(&mut self, rhs: Uint64)
Performs the
%=
operation. Read moresourceimpl<'a> ShrAssign<&'a u32> for Uint64
impl<'a> ShrAssign<&'a u32> for Uint64
sourcefn shr_assign(&mut self, rhs: &'a u32)
fn shr_assign(&mut self, rhs: &'a u32)
Performs the
>>=
operation. Read moresourceimpl ShrAssign<u32> for Uint64
impl ShrAssign<u32> for Uint64
sourcefn shr_assign(&mut self, rhs: u32)
fn shr_assign(&mut self, rhs: u32)
Performs the
>>=
operation. Read moresourceimpl SubAssign<&Uint64> for Uint64
impl SubAssign<&Uint64> for Uint64
sourcefn sub_assign(&mut self, other: &Uint64)
fn sub_assign(&mut self, other: &Uint64)
Performs the
-=
operation. Read moresourceimpl SubAssign<Uint64> for Uint64
impl SubAssign<Uint64> for Uint64
sourcefn sub_assign(&mut self, rhs: Uint64)
fn sub_assign(&mut self, rhs: Uint64)
Performs the
-=
operation. Read moreimpl Copy for Uint64
impl Eq for Uint64
impl StructuralEq for Uint64
impl StructuralPartialEq for Uint64
Auto Trait Implementations
impl RefUnwindSafe for Uint64
impl Send for Uint64
impl Sync for Uint64
impl Unpin for Uint64
impl UnwindSafe for Uint64
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more