Struct ethereum_types::U1024 [−]
Little-endian large integer type
Methods
impl U1024
impl U1024
pub fn from_dec_str(value: &str) -> Result<Self, FromDecStrErr>
pub fn from_dec_str(value: &str) -> Result<Self, FromDecStrErr>
Convert from a decimal string.
pub fn low_u32(&self) -> u32
pub fn low_u32(&self) -> u32
Conversion to u32
pub fn low_u64(&self) -> u64
pub fn low_u64(&self) -> u64
Conversion to u64
pub fn as_u32(&self) -> u32
pub fn as_u32(&self) -> u32
pub fn as_u64(&self) -> u64
pub fn as_u64(&self) -> u64
pub fn is_zero(&self) -> bool
pub fn is_zero(&self) -> bool
Whether this is zero.
pub fn bits(&self) -> usize
pub fn bits(&self) -> usize
Return the least number of bits needed to represent the number
pub fn bit(&self, index: usize) -> bool
pub fn bit(&self, index: usize) -> bool
pub fn leading_zeros(&self) -> u32
pub fn leading_zeros(&self) -> u32
Returns the number of leading zeros in the binary representation of self.
pub fn trailing_zeros(&self) -> u32
pub fn trailing_zeros(&self) -> u32
Returns the number of leading zeros in the binary representation of self.
pub fn byte(&self, index: usize) -> u8
pub fn byte(&self, index: usize) -> u8
pub fn to_big_endian(&self, bytes: &mut [u8])
pub fn to_big_endian(&self, bytes: &mut [u8])
Write to the slice in big-endian format.
pub fn to_little_endian(&self, bytes: &mut [u8])
pub fn to_little_endian(&self, bytes: &mut [u8])
Write to the slice in little-endian format.
pub fn exp10(n: usize) -> Self
pub fn exp10(n: usize) -> Self
pub fn zero() -> Self
pub fn zero() -> Self
Zero (additive identity) of this type.
pub fn one() -> Self
pub fn one() -> Self
One (multiplicative identity) of this type.
pub fn max_value() -> Self
pub fn max_value() -> Self
The maximum value which can be inhabited by this type.
pub fn pow(self, expon: Self) -> Self
pub fn pow(self, expon: Self) -> Self
Fast exponentation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
Panics
Panics if the result overflows the type.
pub fn overflowing_pow(self, expon: Self) -> (Self, bool)
pub fn overflowing_pow(self, expon: Self) -> (Self, bool)
Fast exponentation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
pub fn overflowing_add(self, other: U1024) -> (U1024, bool)
pub fn overflowing_add(self, other: U1024) -> (U1024, bool)
Optimized instructions
pub fn saturating_add(self, other: U1024) -> U1024
pub fn saturating_add(self, other: U1024) -> U1024
Addition which saturates at the maximum value.
pub fn checked_add(self, other: U1024) -> Option<U1024>
pub fn checked_add(self, other: U1024) -> Option<U1024>
Checked addition. Returns None
if overflow occurred.
pub fn overflowing_sub(self, other: U1024) -> (U1024, bool)
pub fn overflowing_sub(self, other: U1024) -> (U1024, bool)
Subtraction which underflows and returns a flag if it does.
pub fn saturating_sub(self, other: U1024) -> U1024
pub fn saturating_sub(self, other: U1024) -> U1024
Subtraction which saturates at zero.
pub fn checked_sub(self, other: U1024) -> Option<U1024>
pub fn checked_sub(self, other: U1024) -> Option<U1024>
Checked subtraction. Returns None
if overflow occurred.
pub fn overflowing_mul(self, other: U1024) -> (U1024, bool)
pub fn overflowing_mul(self, other: U1024) -> (U1024, bool)
Multiply with overflow, returning a flag if it does.
pub fn saturating_mul(self, other: U1024) -> U1024
pub fn saturating_mul(self, other: U1024) -> U1024
Multiplication which saturates at the maximum value..
pub fn checked_mul(self, other: U1024) -> Option<U1024>
pub fn checked_mul(self, other: U1024) -> Option<U1024>
Checked multiplication. Returns None
if overflow occurred.
pub fn overflowing_div(self, other: U1024) -> (U1024, bool)
pub fn overflowing_div(self, other: U1024) -> (U1024, bool)
Division with overflow
pub fn checked_div(self, other: U1024) -> Option<U1024>
pub fn checked_div(self, other: U1024) -> Option<U1024>
Checked division. Returns None
if other == 0
.
pub fn overflowing_rem(self, other: U1024) -> (U1024, bool)
pub fn overflowing_rem(self, other: U1024) -> (U1024, bool)
Modulus with overflow.
pub fn checked_rem(self, other: U1024) -> Option<U1024>
pub fn checked_rem(self, other: U1024) -> Option<U1024>
Checked modulus. Returns None
if other == 0
.
pub fn overflowing_neg(self) -> (U1024, bool)
pub fn overflowing_neg(self) -> (U1024, bool)
Negation with overflow.
pub fn checked_neg(self) -> Option<U1024>
pub fn checked_neg(self) -> Option<U1024>
Checked negation. Returns None
unless self == 0
.
pub fn mul_u32(self, other: u32) -> Self
pub fn mul_u32(self, other: u32) -> Self
: Use Mul<u32> instead.
Multiplication by u32
pub fn to_hex(&self) -> String
pub fn to_hex(&self) -> String
: Use LowerHex instead.
Convert to hex string.
pub fn from_big_endian(slice: &[u8]) -> Self
pub fn from_big_endian(slice: &[u8]) -> Self
Converts from big endian representation bytes in memory
Can also be used as (&slice).into(), as it is default From
slice implementation for U256
pub fn from_little_endian(slice: &[u8]) -> Self
pub fn from_little_endian(slice: &[u8]) -> Self
Converts from little endian representation bytes in memory
Trait Implementations
impl From<U1024> for H1024
[src]
impl From<U1024> for H1024
impl<'a> From<&'a U1024> for H1024
[src]
impl<'a> From<&'a U1024> for H1024
impl From<H1024> for U1024
[src]
impl From<H1024> for U1024
impl<'a> From<&'a H1024> for U1024
[src]
impl<'a> From<&'a H1024> for U1024
impl Copy for U1024
impl Copy for U1024
impl Clone for U1024
impl Clone for U1024
fn clone(&self) -> U1024
fn clone(&self) -> U1024
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Eq for U1024
impl Eq for U1024
impl PartialEq for U1024
impl PartialEq for U1024
fn eq(&self, other: &U1024) -> bool
fn eq(&self, other: &U1024) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &U1024) -> bool
fn ne(&self, other: &U1024) -> bool
This method tests for !=
.
impl Hash for U1024
impl Hash for U1024
fn hash<__H: Hasher>(&self, state: &mut __H)
fn hash<__H: Hasher>(&self, state: &mut __H)
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]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl AsRef<U1024> for U1024
impl AsRef<U1024> for U1024
impl Default for U1024
impl Default for U1024
impl From<u64> for U1024
impl From<u64> for U1024
impl From<u8> for U1024
impl From<u8> for U1024
impl From<u16> for U1024
impl From<u16> for U1024
impl From<u32> for U1024
impl From<u32> for U1024
impl From<usize> for U1024
impl From<usize> for U1024
impl From<i64> for U1024
impl From<i64> for U1024
impl From<i8> for U1024
impl From<i8> for U1024
impl From<i16> for U1024
impl From<i16> for U1024
impl From<i32> for U1024
impl From<i32> for U1024
impl From<isize> for U1024
impl From<isize> for U1024
impl<'a> From<&'a [u8]> for U1024
impl<'a> From<&'a [u8]> for U1024
impl Add<U1024> for U1024
impl Add<U1024> for U1024
type Output = U1024
The resulting type after applying the +
operator.
fn add(self, other: U1024) -> U1024
fn add(self, other: U1024) -> U1024
Performs the +
operation.
impl Sub<U1024> for U1024
impl Sub<U1024> for U1024
type Output = U1024
The resulting type after applying the -
operator.
fn sub(self, other: U1024) -> U1024
fn sub(self, other: U1024) -> U1024
Performs the -
operation.
impl Mul<u32> for U1024
impl Mul<u32> for U1024
type Output = U1024
The resulting type after applying the *
operator.
fn mul(self, other: u32) -> U1024
fn mul(self, other: u32) -> U1024
Performs the *
operation.
impl Mul<U1024> for U1024
impl Mul<U1024> for U1024
type Output = U1024
The resulting type after applying the *
operator.
fn mul(self, other: U1024) -> U1024
fn mul(self, other: U1024) -> U1024
Performs the *
operation.
impl Div<U1024> for U1024
impl Div<U1024> for U1024
type Output = U1024
The resulting type after applying the /
operator.
fn div(self, other: U1024) -> U1024
fn div(self, other: U1024) -> U1024
Performs the /
operation.
impl Rem<U1024> for U1024
impl Rem<U1024> for U1024
type Output = U1024
The resulting type after applying the %
operator.
fn rem(self, other: U1024) -> U1024
fn rem(self, other: U1024) -> U1024
Performs the %
operation.
impl BitAnd<U1024> for U1024
impl BitAnd<U1024> for U1024
type Output = U1024
The resulting type after applying the &
operator.
fn bitand(self, other: U1024) -> U1024
fn bitand(self, other: U1024) -> U1024
Performs the &
operation.
impl BitXor<U1024> for U1024
impl BitXor<U1024> for U1024
type Output = U1024
The resulting type after applying the ^
operator.
fn bitxor(self, other: U1024) -> U1024
fn bitxor(self, other: U1024) -> U1024
Performs the ^
operation.
impl BitOr<U1024> for U1024
impl BitOr<U1024> for U1024
type Output = U1024
The resulting type after applying the |
operator.
fn bitor(self, other: U1024) -> U1024
fn bitor(self, other: U1024) -> U1024
Performs the |
operation.
impl Not for U1024
impl Not for U1024
type Output = U1024
The resulting type after applying the !
operator.
fn not(self) -> U1024
fn not(self) -> U1024
Performs the unary !
operation.
impl Shl<usize> for U1024
impl Shl<usize> for U1024
type Output = U1024
The resulting type after applying the <<
operator.
fn shl(self, shift: usize) -> U1024
fn shl(self, shift: usize) -> U1024
Performs the <<
operation.
impl Shr<usize> for U1024
impl Shr<usize> for U1024
type Output = U1024
The resulting type after applying the >>
operator.
fn shr(self, shift: usize) -> U1024
fn shr(self, shift: usize) -> U1024
Performs the >>
operation.
impl Ord for U1024
impl Ord for U1024
fn cmp(&self, other: &U1024) -> Ordering
fn cmp(&self, other: &U1024) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialOrd for U1024
impl PartialOrd for U1024
fn partial_cmp(&self, other: &U1024) -> Option<Ordering>
fn partial_cmp(&self, other: &U1024) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
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
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
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
impl Debug for U1024
impl Debug for U1024
impl Display for U1024
impl Display for U1024
impl FromStr for U1024
impl FromStr for U1024
type Err = FromHexError
The associated error which can be returned from parsing.
fn from_str(value: &str) -> Result<U1024, Self::Err>
fn from_str(value: &str) -> Result<U1024, Self::Err>
Parses a string s
to return a value of this type. Read more
impl LowerHex for U1024
impl LowerHex for U1024
impl From<&'static str> for U1024
impl From<&'static str> for U1024
impl HeapSizeOf for U1024
impl HeapSizeOf for U1024
fn heap_size_of_children(&self) -> usize
fn heap_size_of_children(&self) -> usize
Measure the size of any heap-allocated structures that hang off this value, but not the space taken up by the value itself (i.e. what size_of:: measures, more or less); that space is handled by the implementation of HeapSizeOf for Box below. Read more
impl Serialize for U1024
[src]
impl Serialize for U1024
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for U1024
[src]
impl<'de> Deserialize<'de> for U1024
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more