Struct etcommon_bigint::U128
[−]
[src]
#[repr(C)]pub struct U128(pub [u64; 2]);
Little-endian large integer type
Methods
impl U128
[src]
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 as_usize(&self) -> usize
Conversion to usize with overflow checking
Panics
Panics if the number is larger than usize::max_value().
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 byte(&self, index: usize) -> u8
Return specific byte. This is in the big endian format.
Panics
Panics if index
exceeds the byte width of the number.
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 min_value() -> Self
The minimum 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: U128) -> (U128, bool)
Optimized instructions
fn saturating_add(self, other: U128) -> U128
Addition which saturates at the maximum value.
fn overflowing_sub(self, other: U128) -> (U128, bool)
Subtraction which underflows and returns a flag if it does.
fn saturating_sub(self, other: U128) -> U128
Subtraction which saturates at zero.
fn overflowing_mul(self, other: U128) -> (U128, bool)
Multiply with overflow, returning a flag if it does.
fn saturating_mul(self, other: U128) -> U128
Multiplication which saturates at the maximum value..
fn overflowing_div(self, other: U128) -> (U128, bool)
Division with overflow
fn overflowing_rem(self, other: U128) -> (U128, bool)
Modulus with overflow.
fn overflowing_neg(self) -> (U128, bool)
Negation with overflow.
Trait Implementations
impl Encodable for U128
[src]
fn rlp_append(&self, s: &mut RlpStream)
Append a value to the stream
fn rlp_bytes(&self) -> ElasticArray1024<u8>
Get rlp-encoded bytes for this instance
impl Decodable for U128
[src]
fn decode(rlp: &UntrustedRlp) -> Result<Self, DecoderError>
Decode a value from RLP bytes
impl Copy for U128
[src]
impl Clone for U128
[src]
fn clone(&self) -> U128
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Eq for U128
[src]
impl PartialEq for U128
[src]
fn eq(&self, __arg_0: &U128) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &U128) -> bool
This method tests for !=
.
impl Hash for U128
[src]
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
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Default for U128
[src]
impl From<u64> for U128
[src]
impl From<u8> for U128
[src]
impl From<u16> for U128
[src]
impl From<u32> for U128
[src]
impl From<usize> for U128
[src]
impl From<i64> for U128
[src]
impl From<i8> for U128
[src]
impl From<i16> for U128
[src]
impl From<i32> for U128
[src]
impl From<isize> for U128
[src]
impl<'a> From<&'a [u8]> for U128
[src]
impl FromStr for U128
[src]
type Err = ParseHexError
The associated error which can be returned from parsing.
fn from_str(value: &str) -> Result<U128, Self::Err>
Parses a string s
to return a value of this type. Read more
impl Add<U128> for U128
[src]
type Output = U128
The resulting type after applying the +
operator
fn add(self, other: U128) -> U128
The method for the +
operator
impl Sub<U128> for U128
[src]
type Output = U128
The resulting type after applying the -
operator
fn sub(self, other: U128) -> U128
The method for the -
operator
impl Mul<U128> for U128
[src]
type Output = U128
The resulting type after applying the *
operator
fn mul(self, other: U128) -> U128
The method for the *
operator
impl Div<U128> for U128
[src]
type Output = U128
The resulting type after applying the /
operator
fn div(self, other: U128) -> U128
The method for the /
operator
impl Rem<U128> for U128
[src]
type Output = U128
The resulting type after applying the %
operator
fn rem(self, other: U128) -> U128
The method for the %
operator
impl BitAnd<U128> for U128
[src]
type Output = U128
The resulting type after applying the &
operator
fn bitand(self, other: U128) -> U128
The method for the &
operator
impl BitXor<U128> for U128
[src]
type Output = U128
The resulting type after applying the ^
operator
fn bitxor(self, other: U128) -> U128
The method for the ^
operator
impl BitOr<U128> for U128
[src]
type Output = U128
The resulting type after applying the |
operator
fn bitor(self, other: U128) -> U128
The method for the |
operator
impl Not for U128
[src]
type Output = U128
The resulting type after applying the !
operator
fn not(self) -> U128
The method for the unary !
operator
impl Shl<usize> for U128
[src]
type Output = U128
The resulting type after applying the <<
operator
fn shl(self, shift: usize) -> U128
The method for the <<
operator
impl Shr<usize> for U128
[src]
type Output = U128
The resulting type after applying the >>
operator
fn shr(self, shift: usize) -> U128
The method for the >>
operator
impl Ord for U128
[src]
fn cmp(&self, other: &U128) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl PartialOrd for U128
[src]
fn partial_cmp(&self, other: &U128) -> 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
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
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
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
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Debug for U128
[src]
impl Display for U128
[src]
impl LowerHex for U128
[src]
impl UpperHex for U128
[src]
impl From<&'static str> for U128
[src]
impl From<U256> for U128
[src]
impl From<U512> for U128
[src]
impl HeapSizeOf for U128
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