Struct Uint128

Source
#[repr(C)]
pub struct Uint128(pub [u64; 2]);
Expand description

Little-endian large integer type

Tuple Fields§

§0: [u64; 2]

Implementations§

Source§

impl Uint128

Source

pub fn as_ptr(&self) -> *const u64

Converts the object to a raw pointer

Source

pub fn as_mut_ptr(&mut self) -> *mut u64

Converts the object to a mutable raw pointer

Source

pub fn len(&self) -> usize

Returns the length of the object as an array

Source

pub fn is_empty(&self) -> bool

Returns whether the object, as an array, is empty. Always false.

Source

pub fn as_bytes(&self) -> &[u64; 2]

Returns the underlying bytes.

Source

pub fn to_bytes(&self) -> [u64; 2]

Returns the underlying bytes.

Source

pub fn into_bytes(self) -> [u64; 2]

Returns the underlying bytes.

Source§

impl Uint128

Source

pub fn low_u32(&self) -> u32

Conversion to u32

Source

pub fn low_u64(&self) -> u64

Conversion to u64

Source

pub fn bits(&self) -> usize

Return the least number of bits needed to represent the number

Source

pub fn mul_u32(self, other: u32) -> Uint128

Multiplication by u32

Source

pub fn from_u64(init: u64) -> Option<Uint128>

Create an object from a given unsigned 64-bit integer

Source

pub fn from_i64(init: i64) -> Option<Uint128>

Create an object from a given signed 64-bit integer

Trait Implementations§

Source§

impl Add for Uint128

Source§

type Output = Uint128

The resulting type after applying the + operator.
Source§

fn add(self, other: Uint128) -> Uint128

Performs the + operation. Read more
Source§

impl BitAnd for Uint128

Source§

type Output = Uint128

The resulting type after applying the & operator.
Source§

fn bitand(self, other: Uint128) -> Uint128

Performs the & operation. Read more
Source§

impl BitArray for Uint128

Source§

fn bit(&self, index: usize) -> bool

Is bit set?
Source§

fn bit_slice(&self, start: usize, end: usize) -> Uint128

Returns an array which is just the bits from start to end
Source§

fn mask(&self, n: usize) -> Uint128

Bitwise and with n ones
Source§

fn trailing_zeros(&self) -> usize

Trailing zeros
Source§

fn zero() -> Uint128

Create all-zeros value
Source§

fn one() -> Uint128

Create value representing one
Source§

impl BitOr for Uint128

Source§

type Output = Uint128

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Uint128) -> Uint128

Performs the | operation. Read more
Source§

impl BitXor for Uint128

Source§

type Output = Uint128

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: Uint128) -> 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<D: Decoder> Decodable<D> for Uint128

Source§

fn consensus_decode(d: &mut D) -> Result<Uint128, Error>

Decode an object with a well-defined format
Source§

impl Default for Uint128

Source§

fn default() -> Uint128

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

impl Display for Uint128

Source§

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

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

impl Div for Uint128

Source§

type Output = Uint128

The resulting type after applying the / operator.
Source§

fn div(self, other: Uint128) -> Uint128

Performs the / operation. Read more
Source§

impl<S: Encoder> Encodable<S> for Uint128

Source§

fn consensus_encode(&self, s: &mut S) -> Result<(), Error>

Encode an object with a well-defined format, should only ever error if the underlying Encoder errors.
Source§

impl<'a> From<&'a [u64]> for Uint128

Source§

fn from(data: &'a [u64]) -> Uint128

Converts to this type from the input type.
Source§

impl Hash for Uint128

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
Source§

fn hash_slice<H>(data: &[Uint128], state: &mut H)
where H: Hasher,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Index<Range<usize>> for Uint128

Source§

type Output = [u64]

The returned type after indexing.
Source§

fn index(&self, index: Range<usize>) -> &[u64]

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<RangeFrom<usize>> for Uint128

Source§

type Output = [u64]

The returned type after indexing.
Source§

fn index(&self, index: RangeFrom<usize>) -> &[u64]

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<RangeFull> for Uint128

Source§

type Output = [u64]

The returned type after indexing.
Source§

fn index(&self, _: RangeFull) -> &[u64]

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<RangeTo<usize>> for Uint128

Source§

type Output = [u64]

The returned type after indexing.
Source§

fn index(&self, index: RangeTo<usize>) -> &[u64]

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<usize> for Uint128

Source§

type Output = u64

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &u64

Performs the indexing (container[index]) operation. Read more
Source§

impl Mul for Uint128

Source§

type Output = Uint128

The resulting type after applying the * operator.
Source§

fn mul(self, other: Uint128) -> Uint128

Performs the * operation. Read more
Source§

impl Not for Uint128

Source§

type Output = Uint128

The resulting type after applying the ! operator.
Source§

fn not(self) -> Uint128

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,

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

impl PartialEq for Uint128

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rand for Uint128

Source§

fn rand<R: Rng>(r: &mut R) -> Uint128

Generates a random instance of this type using the specified source of randomness.
Source§

impl Shl<usize> for Uint128

Source§

type Output = Uint128

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

fn shl(self, shift: usize) -> Uint128

Performs the << operation. Read more
Source§

impl Shr<usize> for Uint128

Source§

type Output = Uint128

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

fn shr(self, shift: usize) -> Uint128

Performs the >> operation. Read more
Source§

impl Sub for Uint128

Source§

type Output = Uint128

The resulting type after applying the - operator.
Source§

fn sub(self, other: Uint128) -> Uint128

Performs the - operation. Read more
Source§

impl Copy for Uint128

Source§

impl Eq 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<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: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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§

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>,

Source§

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>,

Source§

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.