Struct amplify::num::u256[][src]

pub struct u256(_);
Expand description

Little-endian large integer type

Implementations

impl u256[src]

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

Converts the object to a raw pointer

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

Converts the object to a mutable raw pointer

pub fn array_len(&self) -> usize[src]

Returns the length of the object as an array

pub fn len(&self) -> usize[src]

👎 Deprecated since 3.5.2:

use array_len instead

Returns the length of the object as an array

pub fn byte_len(&self) -> usize[src]

Returns the length of the object as an array

pub fn is_empty(&self) -> bool[src]

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

pub fn as_array(&self) -> &[u64; 4][src]

Returns the underlying array of words constituting large integer

pub fn into_array(self) -> [u64; 4][src]

Returns the underlying array of words constituting large integer

pub fn from_array(array: [u64; 4]) -> Self[src]

Constructs integer type from the underlying array of words.

impl u256[src]

pub fn low_u32(&self) -> u32[src]

Conversion to u32

pub fn low_u64(&self) -> u64[src]

Conversion to u64

pub fn bits(&self) -> usize[src]

Return the least number of bits needed to represent the number

pub fn mul_u32(self, other: u32) -> u256[src]

Multiplication by u32

pub fn from_u64(init: u64) -> Option<u256>[src]

Create an object from a given unsigned 64-bit integer

pub fn from_i64(init: i64) -> Option<u256>[src]

Create an object from a given signed 64-bit integer

pub fn from_be_bytes(bytes: [u8; 32]) -> u256[src]

Creates the integer value from a byte array using big-endian encoding

pub fn from_be_slice(bytes: &[u8]) -> Result<u256, ParseLengthError>[src]

Creates the integer value from a byte slice using big-endian encoding

pub fn from_le_bytes(bytes: [u8; 32]) -> u256[src]

Creates the integer value from a byte array using little-endian encoding

pub fn from_le_slice(bytes: &[u8]) -> Result<u256, ParseLengthError>[src]

Creates the integer value from a byte slice using little-endian encoding

pub fn to_be_bytes(self) -> [u8; 32][src]

Convert the integer into a byte array using big-endian encoding

pub fn to_le_bytes(self) -> [u8; 32][src]

Convert a integer into a byte array using lottle-endian encoding

impl u256[src]

pub fn increment(&mut self)[src]

Increment by 1

Trait Implementations

impl Add<u256> for u256[src]

type Output = u256

The resulting type after applying the + operator.

fn add(self, other: u256) -> u256[src]

Performs the + operation. Read more

impl BitAnd<u256> for u256[src]

type Output = u256

The resulting type after applying the & operator.

fn bitand(self, other: u256) -> u256[src]

Performs the & operation. Read more

impl BitArray for u256[src]

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

Is bit set?

fn bit_slice(&self, start: usize, end: usize) -> u256[src]

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

fn mask(&self, n: usize) -> u256[src]

Bitwise and with n ones

fn trailing_zeros(&self) -> usize[src]

Trailing zeros

fn zero() -> u256[src]

Create all-zeros value

fn one() -> u256[src]

Create value representing one

impl BitOr<u256> for u256[src]

type Output = u256

The resulting type after applying the | operator.

fn bitor(self, other: u256) -> u256[src]

Performs the | operation. Read more

impl BitXor<u256> for u256[src]

type Output = u256

The resulting type after applying the ^ operator.

fn bitxor(self, other: u256) -> u256[src]

Performs the ^ operation. Read more

impl Clone for u256[src]

fn clone(&self) -> u256[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for u256[src]

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

Formats the value using the given formatter. Read more

impl Default for u256[src]

fn default() -> u256[src]

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

impl Display for u256[src]

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

Formats the value using the given formatter. Read more

impl Div<u256> for u256[src]

type Output = u256

The resulting type after applying the / operator.

fn div(self, other: u256) -> u256[src]

Performs the / operation. Read more

impl Hash for u256[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

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

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

impl Index<Range<usize>> for u256[src]

type Output = [u64]

The returned type after indexing.

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

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

impl Index<RangeFrom<usize>> for u256[src]

type Output = [u64]

The returned type after indexing.

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

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

impl Index<RangeFull> for u256[src]

type Output = [u64]

The returned type after indexing.

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

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

impl Index<RangeTo<usize>> for u256[src]

type Output = [u64]

The returned type after indexing.

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

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

impl Index<usize> for u256[src]

type Output = u64

The returned type after indexing.

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

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

impl Mul<u256> for u256[src]

type Output = u256

The resulting type after applying the * operator.

fn mul(self, other: u256) -> u256[src]

Performs the * operation. Read more

impl Not for u256[src]

type Output = u256

The resulting type after applying the ! operator.

fn not(self) -> u256[src]

Performs the unary ! operation. Read more

impl Ord for u256[src]

fn cmp(&self, other: &u256) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<u256> for u256[src]

fn eq(&self, other: &u256) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &u256) -> bool[src]

This method tests for !=.

impl PartialOrd<u256> for u256[src]

fn partial_cmp(&self, other: &u256) -> Option<Ordering>[src]

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

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

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

impl Rem<u256> for u256[src]

type Output = u256

The resulting type after applying the % operator.

fn rem(self, other: u256) -> u256[src]

Performs the % operation. Read more

impl Shl<usize> for u256[src]

type Output = u256

The resulting type after applying the << operator.

fn shl(self, shift: usize) -> u256[src]

Performs the << operation. Read more

impl Shr<usize> for u256[src]

type Output = u256

The resulting type after applying the >> operator.

fn shr(self, shift: usize) -> u256[src]

Performs the >> operation. Read more

impl Sub<u256> for u256[src]

type Output = u256

The resulting type after applying the - operator.

fn sub(self, other: u256) -> u256[src]

Performs the - operation. Read more

impl<'a> TryFrom<&'a [u64]> for u256[src]

type Error = ParseLengthError

The type returned in the event of a conversion error.

fn try_from(data: &'a [u64]) -> Result<u256, Self::Error>[src]

Performs the conversion.

impl Copy for u256[src]

impl Eq for u256[src]

impl StructuralEq for u256[src]

impl StructuralPartialEq for u256[src]

Auto Trait Implementations

impl RefUnwindSafe for u256

impl Send for u256

impl Sync for u256

impl Unpin for u256

impl UnwindSafe for u256

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

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]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.