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