Struct cosmwasm_std::Uint128

source ·
pub struct Uint128(/* private fields */);
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§

source§

impl Uint128

source

pub const MAX: Self = _

source

pub const MIN: Self = _

source

pub const fn new(value: u128) -> Self

Creates a Uint128(value).

This method is less flexible than from but can be called in a const context.

source

pub const fn zero() -> Self

Creates a Uint128(0)

source

pub const fn one() -> Self

Creates a Uint128(1)

source

pub const fn u128(&self) -> u128

Returns a copy of the internal data

source

pub const fn to_be_bytes(self) -> [u8; 16]

Returns a copy of the number as big endian bytes.

source

pub const fn to_le_bytes(self) -> [u8; 16]

Returns a copy of the number as little endian bytes.

source

pub const fn is_zero(&self) -> bool

source

pub const fn pow(self, exp: u32) -> Self

source

pub fn ilog2(self) -> u32

Returns the base 2 logarithm of the number, rounded down.

§Panics

This function will panic if self is zero.

source

pub fn multiply_ratio<A: Into<u128>, B: Into<u128>>( &self, numerator: A, denominator: B, ) -> Uint128

Returns self * numerator / denominator.

Due to the nature of the integer division involved, the result is always floored. E.g. 5 * 99/100 = 4.

source

pub fn checked_multiply_ratio<A: Into<u128>, B: Into<u128>>( &self, numerator: A, denominator: B, ) -> Result<Uint128, CheckedMultiplyRatioError>

Returns self * numerator / denominator.

Due to the nature of the integer division involved, the result is always floored. E.g. 5 * 99/100 = 4.

source

pub fn full_mul(self, rhs: impl Into<Self>) -> Uint256

Multiplies two u128 values without overflow, producing an Uint256.

§Examples
use cosmwasm_std::Uint128;

let a = Uint128::MAX;
let result = a.full_mul(2u32);
assert_eq!(result.to_string(), "680564733841876926926749214863536422910");
source

pub fn checked_add(self, other: Self) -> Result<Self, OverflowError>

source

pub fn checked_sub(self, other: Self) -> Result<Self, OverflowError>

source

pub fn checked_mul(self, other: Self) -> Result<Self, OverflowError>

source

pub fn checked_pow(self, exp: u32) -> Result<Self, OverflowError>

source

pub fn checked_div(self, other: Self) -> Result<Self, DivideByZeroError>

source

pub fn checked_div_euclid(self, other: Self) -> Result<Self, DivideByZeroError>

source

pub fn checked_rem(self, other: Self) -> Result<Self, DivideByZeroError>

source

pub fn checked_shr(self, other: u32) -> Result<Self, OverflowError>

source

pub fn checked_shl(self, other: u32) -> Result<Self, OverflowError>

source

pub fn wrapping_add(self, other: Self) -> Self

source

pub fn wrapping_sub(self, other: Self) -> Self

source

pub fn wrapping_mul(self, other: Self) -> Self

source

pub fn wrapping_pow(self, other: u32) -> Self

source

pub fn saturating_add(self, other: Self) -> Self

source

pub fn saturating_sub(self, other: Self) -> Self

source

pub fn saturating_mul(self, other: Self) -> Self

source

pub fn saturating_pow(self, exp: u32) -> Self

source

pub const fn strict_add(self, rhs: Self) -> Self

Strict integer addition. Computes self + rhs, panicking if overflow occurred.

This is the same as Uint128::add but const.

source

pub const fn strict_sub(self, other: Self) -> Self

Strict integer subtraction. Computes self - rhs, panicking if overflow occurred.

This is the same as Uint128::sub but const.

source

pub const fn abs_diff(self, other: Self) -> Self

source§

impl Uint128

source

pub fn checked_mul_floor<F: Fraction<T>, T: Into<Uint128>>( self, rhs: F, ) -> Result<Self, CheckedMultiplyFractionError>

Multiply self with a struct implementing Fraction (e.g. crate::Decimal). Result is rounded down.

§Examples
use cosmwasm_std::Uint128;
let fraction = (8u128, 21u128);
let res = Uint128::new(123456).checked_mul_floor(fraction).unwrap();
assert_eq!(Uint128::new(47030), res); // 47030.8571 rounds down
source

pub fn mul_floor<F: Fraction<T>, T: Into<Uint128>>(self, rhs: F) -> Self

Same operation as checked_mul_floor except unwrapped

source

pub fn checked_mul_ceil<F: Fraction<T>, T: Into<Uint128>>( self, rhs: F, ) -> Result<Self, CheckedMultiplyFractionError>

Multiply self with a struct implementing Fraction (e.g. crate::Decimal). Result is rounded up.

§Examples
use cosmwasm_std::Uint128;
let fraction = (8u128, 21u128);
let res = Uint128::new(123456).checked_mul_ceil(fraction).unwrap();
assert_eq!(Uint128::new(47031), res); // 47030.8571 rounds up
source

pub fn mul_ceil<F: Fraction<T>, T: Into<Uint128>>(self, rhs: F) -> Self

Same operation as checked_mul_ceil except unwrapped

source

pub fn checked_div_floor<F: Fraction<T>, T: Into<Uint128>>( self, rhs: F, ) -> Result<Self, CheckedMultiplyFractionError>
where Self: Sized,

Divide self with a struct implementing Fraction (e.g. crate::Decimal). Result is rounded down.

§Examples
use cosmwasm_std::Uint128;
let fraction = (4u128, 5u128);
let res = Uint128::new(789).checked_div_floor(fraction).unwrap();
assert_eq!(Uint128::new(986), res); // 986.25 rounds down
source

pub fn div_floor<F: Fraction<T>, T: Into<Uint128>>(self, rhs: F) -> Self
where Self: Sized,

Same operation as checked_div_floor except unwrapped

source

pub fn checked_div_ceil<F: Fraction<T>, T: Into<Uint128>>( self, rhs: F, ) -> Result<Self, CheckedMultiplyFractionError>
where Self: Sized,

Divide self with a struct implementing Fraction (e.g. crate::Decimal). Result is rounded up.

§Examples
use cosmwasm_std::Uint128;
let fraction = (4u128, 5u128);
let res = Uint128::new(789).checked_div_ceil(fraction).unwrap();
assert_eq!(Uint128::new(987), res); // 986.25 rounds up
source

pub fn div_ceil<F: Fraction<T>, T: Into<Uint128>>(self, rhs: F) -> Self
where Self: Sized,

Same operation as checked_div_ceil except unwrapped

Trait Implementations§

source§

impl Add<&Uint128> for &Uint128

§

type Output = <Uint128 as Add>::Output

The resulting type after applying the + operator.
source§

fn add(self, other: &Uint128) -> <Uint128 as Add<Uint128>>::Output

Performs the + operation. Read more
source§

impl Add<&Uint128> for Uint128

§

type Output = <Uint128 as Add>::Output

The resulting type after applying the + operator.
source§

fn add(self, other: &Uint128) -> <Uint128 as Add<Uint128>>::Output

Performs the + operation. Read more
source§

impl<'a> Add<Uint128> for &'a Uint128

§

type Output = <Uint128 as Add>::Output

The resulting type after applying the + operator.
source§

fn add(self, other: Uint128) -> <Uint128 as Add<Uint128>>::Output

Performs the + operation. Read more
source§

impl Add for Uint128

§

type Output = Uint128

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
source§

impl<'a> AddAssign<&'a Uint128> for Uint128

source§

fn add_assign(&mut self, rhs: &'a Uint128)

Performs the += operation. Read more
source§

impl AddAssign for Uint128

source§

fn add_assign(&mut self, rhs: Uint128)

Performs the += operation. Read more
source§

impl Clone for Uint128

source§

fn clone(&self) -> Uint128

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Uint128

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Uint128

source§

fn default() -> Uint128

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Uint128

source§

fn deserialize<D>(deserializer: D) -> Result<Uint128, D::Error>
where D: Deserializer<'de>,

Deserialized from an integer string using base 10

source§

impl Display for Uint128

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Div<&'a Uint128> for Uint128

§

type Output = Uint128

The resulting type after applying the / operator.
source§

fn div(self, rhs: &'a Uint128) -> Self::Output

Performs the / operation. Read more
source§

impl Div<Uint128> for Decimal

§

type Output = Decimal

The resulting type after applying the / operator.
source§

fn div(self, rhs: Uint128) -> Self::Output

Performs the / operation. Read more
source§

impl Div for Uint128

§

type Output = Uint128

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl<'a> DivAssign<&'a Uint128> for Uint128

source§

fn div_assign(&mut self, rhs: &'a Uint128)

Performs the /= operation. Read more
source§

impl DivAssign<Uint128> for Decimal

source§

fn div_assign(&mut self, rhs: Uint128)

Performs the /= operation. Read more
source§

impl DivAssign for Uint128

source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
source§

impl Fraction<Uint128> for Decimal

source§

fn inv(&self) -> Option<Self>

Returns the multiplicative inverse 1/d for decimal d.

If d is zero, none is returned.

source§

fn numerator(&self) -> Uint128

Returns the numerator p
source§

fn denominator(&self) -> Uint128

Returns the denominator q
source§

impl From<Uint128> for Int256

source§

fn from(val: Uint128) -> Self

Converts to this type from the input type.
source§

impl From<Uint128> for Int512

source§

fn from(val: Uint128) -> Self

Converts to this type from the input type.
source§

impl From<Uint128> for String

source§

fn from(original: Uint128) -> Self

Converts to this type from the input type.
source§

impl From<Uint128> for Uint256

source§

fn from(val: Uint128) -> Self

Converts to this type from the input type.
source§

impl From<Uint128> for Uint512

source§

fn from(val: Uint128) -> Self

Converts to this type from the input type.
source§

impl From<Uint128> for u128

source§

fn from(original: Uint128) -> Self

Converts to this type from the input type.
source§

impl From<Uint64> for Uint128

source§

fn from(val: Uint64) -> Self

Converts to this type from the input type.
source§

impl From<u128> for Uint128

source§

fn from(val: u128) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Uint128

source§

fn from(val: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Uint128

source§

fn from(val: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Uint128

source§

fn from(val: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Uint128

source§

fn from(val: u8) -> Self

Converts to this type from the input type.
source§

impl FromStr for Uint128

§

type Err = StdError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl JsonSchema for Uint128

source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl Mul<&Uint128> for &Uint128

§

type Output = <Uint128 as Mul>::Output

The resulting type after applying the * operator.
source§

fn mul(self, other: &Uint128) -> <Uint128 as Mul<Uint128>>::Output

Performs the * operation. Read more
source§

impl Mul<&Uint128> for Uint128

§

type Output = <Uint128 as Mul>::Output

The resulting type after applying the * operator.
source§

fn mul(self, other: &Uint128) -> <Uint128 as Mul<Uint128>>::Output

Performs the * operation. Read more
source§

impl<'a> Mul<Uint128> for &'a Uint128

§

type Output = <Uint128 as Mul>::Output

The resulting type after applying the * operator.
source§

fn mul(self, other: Uint128) -> <Uint128 as Mul<Uint128>>::Output

Performs the * operation. Read more
source§

impl Mul for Uint128

§

type Output = Uint128

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl MulAssign<&Uint128> for Uint128

source§

fn mul_assign(&mut self, other: &Uint128)

Performs the *= operation. Read more
source§

impl MulAssign for Uint128

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl Not for Uint128

§

type Output = Uint128

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl Ord for Uint128

source§

fn cmp(&self, other: &Uint128) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<&Uint128> for Uint128

source§

fn eq(&self, rhs: &&Uint128) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<Uint128> for &'a Uint128

source§

fn eq(&self, rhs: &Uint128) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for Uint128

source§

fn eq(&self, other: &Uint128) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Uint128

source§

fn partial_cmp(&self, other: &Uint128) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Rem<&Uint128> for &Uint128

§

type Output = <Uint128 as Rem>::Output

The resulting type after applying the % operator.
source§

fn rem(self, other: &Uint128) -> <Uint128 as Rem<Uint128>>::Output

Performs the % operation. Read more
source§

impl Rem<&Uint128> for Uint128

§

type Output = <Uint128 as Rem>::Output

The resulting type after applying the % operator.
source§

fn rem(self, other: &Uint128) -> <Uint128 as Rem<Uint128>>::Output

Performs the % operation. Read more
source§

impl<'a> Rem<Uint128> for &'a Uint128

§

type Output = <Uint128 as Rem>::Output

The resulting type after applying the % operator.
source§

fn rem(self, other: Uint128) -> <Uint128 as Rem<Uint128>>::Output

Performs the % operation. Read more
source§

impl Rem for Uint128

source§

fn rem(self, rhs: Self) -> Self

§Panics

This operation will panic if rhs is zero.

§

type Output = Uint128

The resulting type after applying the % operator.
source§

impl RemAssign<&Uint128> for Uint128

source§

fn rem_assign(&mut self, other: &Uint128)

Performs the %= operation. Read more
source§

impl RemAssign for Uint128

source§

fn rem_assign(&mut self, rhs: Uint128)

Performs the %= operation. Read more
source§

impl Serialize for Uint128

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serializes as an integer string using base 10

source§

impl<'a> Shl<&'a u32> for Uint128

§

type Output = Uint128

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &'a u32) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<u32> for Uint128

§

type Output = Uint128

The resulting type after applying the << operator.
source§

fn shl(self, rhs: u32) -> Self::Output

Performs the << operation. Read more
source§

impl<'a> ShlAssign<&'a u32> for Uint128

source§

fn shl_assign(&mut self, rhs: &'a u32)

Performs the <<= operation. Read more
source§

impl ShlAssign<u32> for Uint128

source§

fn shl_assign(&mut self, rhs: u32)

Performs the <<= operation. Read more
source§

impl<'a> Shr<&'a u32> for Uint128

§

type Output = Uint128

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &'a u32) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<u32> for Uint128

§

type Output = Uint128

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u32) -> Self::Output

Performs the >> operation. Read more
source§

impl<'a> ShrAssign<&'a u32> for Uint128

source§

fn shr_assign(&mut self, rhs: &'a u32)

Performs the >>= operation. Read more
source§

impl ShrAssign<u32> for Uint128

source§

fn shr_assign(&mut self, rhs: u32)

Performs the >>= operation. Read more
source§

impl Sub<&Uint128> for &Uint128

§

type Output = <Uint128 as Sub>::Output

The resulting type after applying the - operator.
source§

fn sub(self, other: &Uint128) -> <Uint128 as Sub<Uint128>>::Output

Performs the - operation. Read more
source§

impl Sub<&Uint128> for Uint128

§

type Output = <Uint128 as Sub>::Output

The resulting type after applying the - operator.
source§

fn sub(self, other: &Uint128) -> <Uint128 as Sub<Uint128>>::Output

Performs the - operation. Read more
source§

impl<'a> Sub<Uint128> for &'a Uint128

§

type Output = <Uint128 as Sub>::Output

The resulting type after applying the - operator.
source§

fn sub(self, other: Uint128) -> <Uint128 as Sub<Uint128>>::Output

Performs the - operation. Read more
source§

impl Sub for Uint128

§

type Output = Uint128

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
source§

impl SubAssign<&Uint128> for Uint128

source§

fn sub_assign(&mut self, other: &Uint128)

Performs the -= operation. Read more
source§

impl SubAssign for Uint128

source§

fn sub_assign(&mut self, rhs: Uint128)

Performs the -= operation. Read more
source§

impl<A> Sum<A> for Uint128
where Self: Add<A, Output = Self>,

source§

fn sum<I: Iterator<Item = A>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl TryFrom<&str> for Uint128

§

type Error = StdError

The type returned in the event of a conversion error.
source§

fn try_from(val: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Int128> for Uint128

§

type Error = ConversionOverflowError

The type returned in the event of a conversion error.
source§

fn try_from(value: Int128) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Int256> for Uint128

§

type Error = ConversionOverflowError

The type returned in the event of a conversion error.
source§

fn try_from(value: Int256) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Int512> for Uint128

§

type Error = ConversionOverflowError

The type returned in the event of a conversion error.
source§

fn try_from(value: Int512) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Int64> for Uint128

§

type Error = ConversionOverflowError

The type returned in the event of a conversion error.
source§

fn try_from(value: Int64) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Uint128> for Decimal

§

type Error = DecimalRangeExceeded

The type returned in the event of a conversion error.
source§

fn try_from(value: Uint128) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Uint128> for Int128

§

type Error = ConversionOverflowError

The type returned in the event of a conversion error.
source§

fn try_from(value: Uint128) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Uint128> for Int64

§

type Error = ConversionOverflowError

The type returned in the event of a conversion error.
source§

fn try_from(value: Uint128) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Uint128> for Uint64

§

type Error = ConversionOverflowError

The type returned in the event of a conversion error.
source§

fn try_from(value: Uint128) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Uint256> for Uint128

§

type Error = ConversionOverflowError

The type returned in the event of a conversion error.
source§

fn try_from(value: Uint256) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Uint512> for Uint128

§

type Error = ConversionOverflowError

The type returned in the event of a conversion error.
source§

fn try_from(value: Uint512) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Copy for Uint128

source§

impl Eq for Uint128

source§

impl StructuralPartialEq for Uint128

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<U> As for U

source§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<I> Isqrt for I
where I: Div<Output = I> + Unsigned + Shl<u32, Output = I> + Add<Output = I> + Shr<u32, Output = I> + PartialOrd + Copy,

source§

fn isqrt(self) -> I

Algorithm adapted from Wikipedia.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T, Rhs, Output> GroupOps<Rhs, Output> for T
where T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>,

source§

impl<T, Rhs, Output> GroupOpsOwned<Rhs, Output> for T
where T: for<'r> GroupOps<&'r Rhs, Output>,

source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,

source§

impl<T, Rhs, Output> ScalarMul<Rhs, Output> for T
where T: Mul<Rhs, Output = Output> + MulAssign<Rhs>,

source§

impl<T, Rhs, Output> ScalarMulOwned<Rhs, Output> for T
where T: for<'r> ScalarMul<&'r Rhs, Output>,