Struct ethane::types::U128 [−]
Little-endian large integer type 128-bit unsigned integer.
Implementations
impl U128
impl U128
impl U128
impl U128
pub const MAX: U128
Maximum value.
pub fn from_str_radix(txt: &str, radix: u32) -> Result<U128, FromStrRadixErr>
Converts a string slice in a given base to an integer. Only supports radixes of 10 and 16.
pub fn from_dec_str(value: &str) -> Result<U128, FromDecStrErr>
Convert from a decimal string.
pub const fn low_u32(&self) -> u32
Conversion to u32
pub const fn low_u64(&self) -> u64
Low word (u64)
pub fn as_u32(&self) -> u32
pub fn as_u64(&self) -> u64
Conversion to u64 with overflow checking
Panics
Panics if the number is larger than u64::max_value().
pub fn as_usize(&self) -> usize
Conversion to usize with overflow checking
Panics
Panics if the number is larger than usize::max_value().
pub fn is_zero(&self) -> bool
Whether this is zero.
pub fn bits(&self) -> usize
Return the least number of bits needed to represent the number
pub const fn bit(&self, index: usize) -> bool
pub fn leading_zeros(&self) -> u32
Returns the number of leading zeros in the binary representation of self.
pub fn trailing_zeros(&self) -> u32
Returns the number of trailing zeros in the binary representation of self.
pub const fn byte(&self, index: usize) -> 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])
Write to the slice in little-endian format.
pub fn exp10(n: usize) -> U128
pub const fn zero() -> U128
Zero (additive identity) of this type.
pub fn one() -> U128
One (multiplicative identity) of this type.
pub fn max_value() -> U128
The maximum value which can be inhabited by this type.
pub fn div_mod(self, other: U128) -> (U128, U128)
pub fn pow(self, expon: U128) -> U128
Fast exponentiation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
Panics
Panics if the result overflows the type.
pub fn overflowing_pow(self, expon: U128) -> (U128, bool)
Fast exponentiation by squaring. Returns result and overflow flag.
pub fn checked_pow(self, expon: U128) -> Option<U128>
Checked exponentiation. Returns None
if overflow occurred.
pub fn overflowing_add(self, other: U128) -> (U128, bool)
Add with overflow.
pub fn saturating_add(self, other: U128) -> U128
Addition which saturates at the maximum value (Self::max_value()).
pub fn checked_add(self, other: U128) -> Option<U128>
Checked addition. Returns None
if overflow occurred.
pub fn overflowing_sub(self, other: U128) -> (U128, bool)
Subtraction which underflows and returns a flag if it does.
pub fn saturating_sub(self, other: U128) -> U128
Subtraction which saturates at zero.
pub fn checked_sub(self, other: U128) -> Option<U128>
Checked subtraction. Returns None
if overflow occurred.
pub fn overflowing_mul(self, other: U128) -> (U128, bool)
Multiply with overflow, returning a flag if it does.
pub fn saturating_mul(self, other: U128) -> U128
Multiplication which saturates at the maximum value..
pub fn checked_mul(self, other: U128) -> Option<U128>
Checked multiplication. Returns None
if overflow occurred.
pub fn checked_div(self, other: U128) -> Option<U128>
Checked division. Returns None
if other == 0
.
pub fn checked_rem(self, other: U128) -> Option<U128>
Checked modulus. Returns None
if other == 0
.
pub fn overflowing_neg(self) -> (U128, bool)
Negation with overflow.
pub fn checked_neg(self) -> Option<U128>
Checked negation. Returns None
unless self == 0
.
pub fn from_big_endian(slice: &[u8]) -> U128
Converts from big endian representation bytes in memory.
pub fn from_little_endian(slice: &[u8]) -> U128
Converts from little endian representation bytes in memory.
Trait Implementations
impl AddAssign<U128> for U128
impl AddAssign<U128> for U128
pub fn add_assign(&mut self, other: U128)
impl Decode for U128
impl Decode for U128
impl<'de> Deserialize<'de> for U128
impl<'de> Deserialize<'de> for U128
pub fn deserialize<D>(
deserializer: D
) -> Result<U128, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
deserializer: D
) -> Result<U128, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
impl<T> DivAssign<T> for U128 where
T: Into<U128>,
impl<T> DivAssign<T> for U128 where
T: Into<U128>,
pub fn div_assign(&mut self, other: T)
impl Encodable for U128
impl Encodable for U128
pub fn rlp_append(&self, s: &mut RlpStream)
pub fn rlp_bytes(&self) -> BytesMut
impl Encode for U128
impl Encode for U128
impl MulAssign<U128> for U128
impl MulAssign<U128> for U128
pub fn mul_assign(&mut self, other: U128)
impl MulAssign<i16> for U128
impl MulAssign<i16> for U128
pub fn mul_assign(&mut self, other: i16)
impl MulAssign<i32> for U128
impl MulAssign<i32> for U128
pub fn mul_assign(&mut self, other: i32)
impl MulAssign<i64> for U128
impl MulAssign<i64> for U128
pub fn mul_assign(&mut self, other: i64)
impl MulAssign<i8> for U128
impl MulAssign<i8> for U128
pub fn mul_assign(&mut self, other: i8)
impl MulAssign<isize> for U128
impl MulAssign<isize> for U128
pub fn mul_assign(&mut self, other: isize)
impl MulAssign<u16> for U128
impl MulAssign<u16> for U128
pub fn mul_assign(&mut self, other: u16)
impl MulAssign<u32> for U128
impl MulAssign<u32> for U128
pub fn mul_assign(&mut self, other: u32)
impl MulAssign<u64> for U128
impl MulAssign<u64> for U128
pub fn mul_assign(&mut self, other: u64)
impl MulAssign<u8> for U128
impl MulAssign<u8> for U128
pub fn mul_assign(&mut self, other: u8)
impl MulAssign<usize> for U128
impl MulAssign<usize> for U128
pub fn mul_assign(&mut self, other: usize)
impl PartialOrd<U128> for U128
impl PartialOrd<U128> for U128
impl Serialize for U128
impl Serialize for U128
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl<T> ShlAssign<T> for U128 where
T: Into<U128>,
impl<T> ShlAssign<T> for U128 where
T: Into<U128>,
pub fn shl_assign(&mut self, shift: T)
impl<T> ShrAssign<T> for U128 where
T: Into<U128>,
impl<T> ShrAssign<T> for U128 where
T: Into<U128>,
pub fn shr_assign(&mut self, shift: T)
impl StructuralEq for U128
impl StructuralEq for U128
impl StructuralPartialEq for U128
impl StructuralPartialEq for U128
impl SubAssign<U128> for U128
impl SubAssign<U128> for U128
pub fn sub_assign(&mut self, other: U128)
Auto Trait Implementations
impl RefUnwindSafe for U128
impl RefUnwindSafe for U128
impl UnwindSafe for U128
impl UnwindSafe for U128
Blanket Implementations
impl<T, U> AsByteSlice<T> for U where
T: ToByteSlice,
U: AsRef<[T]> + ?Sized,
impl<T, U> AsByteSlice<T> for U where
T: ToByteSlice,
U: AsRef<[T]> + ?Sized,
pub fn as_byte_slice(&self) -> &[u8]
impl<T> DecodeAll for T where
T: Decode,
impl<T> DecodeAll for T where
T: Decode,
pub fn decode_all(input: &[u8]) -> Result<T, Error>
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
T: Encode,
impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
T: Encode,
impl<'_, T> EncodeLike<&'_ T> for T where
T: Encode,
impl<'_, T> EncodeLike<&'_ T> for T where
T: Encode,
impl<'_, T> EncodeLike<&'_ mut T> for T where
T: Encode,
impl<'_, T> EncodeLike<&'_ mut T> for T where
T: Encode,
impl<T> EncodeLike<Arc<T>> for T where
T: Encode,
impl<T> EncodeLike<Arc<T>> for T where
T: Encode,
impl<T> EncodeLike<Rc<T>> for T where
T: Encode,
impl<T> EncodeLike<Rc<T>> for T where
T: Encode,
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,