pub struct U256(/* private fields */);Implementations§
Source§impl U256
impl U256
Sourcepub const fn max_value() -> Self
pub const fn max_value() -> Self
Max value of U256: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Sourcepub fn from_str_radix(src: &str, radix: u32) -> Result<Self, U256FromStrError>
pub fn from_str_radix(src: &str, radix: u32) -> Result<Self, U256FromStrError>
U256 from string with radix 10 or 16
Sourcepub fn from_le_bytes(slice: &[u8; 32]) -> Self
pub fn from_le_bytes(slice: &[u8; 32]) -> Self
U256 from 32 little endian bytes
Sourcepub fn to_le_bytes(self) -> [u8; 32]
pub fn to_le_bytes(self) -> [u8; 32]
U256 to 32 little endian bytes
Sourcepub fn leading_zeros(&self) -> u32
pub fn leading_zeros(&self) -> u32
Leading zeros of the number
pub const fn unchecked_as_u8(&self) -> u8
pub const fn unchecked_as_u16(&self) -> u16
pub const fn unchecked_as_u32(&self) -> u32
pub const fn unchecked_as_u64(&self) -> u64
pub const fn unchecked_as_u128(&self) -> u128
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Checked integer addition. Computes self + rhs, returning None if overflow occurred.
Sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Checked integer subtraction. Computes self - rhs, returning None if overflow occurred.
Sourcepub fn checked_mul(self, rhs: Self) -> Option<Self>
pub fn checked_mul(self, rhs: Self) -> Option<Self>
Checked integer multiplication. Computes self * rhs, returning None if overflow occurred.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Checked integer division. Computes self / rhs, returning None if rhs == 0.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Checked integer remainder. Computes self % rhs, returning None if rhs == 0.
Sourcepub fn checked_shl(self, rhs: u32) -> Option<Self>
pub fn checked_shl(self, rhs: u32) -> Option<Self>
Checked integer remainder. Computes self % rhs, returning None if rhs == 0.
Sourcepub fn checked_shr(self, rhs: u32) -> Option<Self>
pub fn checked_shr(self, rhs: u32) -> Option<Self>
Checked shift right. Computes self >> rhs, returning None if rhs is larger than or equal to the number of bits in self.
Sourcepub fn down_cast_lossy<T: TryFrom<u128>>(self) -> T
pub fn down_cast_lossy<T: TryFrom<u128>>(self) -> T
Downcast to a an unsigned value of type T T must be at most u128
Sourcepub fn wrapping_add(self, rhs: Self) -> Self
pub fn wrapping_add(self, rhs: Self) -> Self
Wrapping integer addition. Computes self + rhs, wrapping around at the boundary of the type. By definition in std::instrinsics, a.wrapping_add(b) = (a + b) % (2^N), where N is bit width
Sourcepub fn wrapping_sub(self, rhs: Self) -> Self
pub fn wrapping_sub(self, rhs: Self) -> Self
Wrapping integer subtraction. Computes self - rhs, wrapping around at the boundary of the type. By definition in std::instrinsics, a.wrapping_add(b) = (a - b) % (2^N), where N is bit width
Sourcepub fn wrapping_mul(self, rhs: Self) -> Self
pub fn wrapping_mul(self, rhs: Self) -> Self
Wrapping integer multiplication. Computes self * rhs, wrapping around at the boundary of the type. By definition in std::instrinsics, a.wrapping_mul(b) = (a * b) % (2^N), where N is bit width
pub fn from_f64_lossy(value: f64) -> Self
pub fn to_f64_lossy(self) -> f64
Trait Implementations§
Source§impl AddAssign for U256
impl AddAssign for U256
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl Arbitrary for U256
Available on crate feature proptest only.
impl Arbitrary for U256
proptest only.Source§type Strategy = BoxedStrategy<U256>
type Strategy = BoxedStrategy<U256>
Strategy used to generate values of type Self.Source§type Parameters = ()
type Parameters = ()
arbitrary_with accepts for configuration
of the generated Strategy. Parameters must implement Default.Source§fn arbitrary_with(_params: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_params: Self::Parameters) -> Self::Strategy
Source§impl BitAndAssign for U256
impl BitAndAssign for U256
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&= operation. Read moreSource§impl<'de> Deserialize<'de> for U256
Available on crate feature serde only.
impl<'de> Deserialize<'de> for U256
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl DivAssign for U256
impl DivAssign for U256
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moreSource§impl MulAssign for U256
impl MulAssign for U256
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreSource§impl Ord for U256
impl Ord for U256
Source§impl PartialOrd for U256
impl PartialOrd for U256
Source§impl RemAssign for U256
impl RemAssign for U256
Source§fn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
%= operation. Read moreSource§impl SubAssign for U256
impl SubAssign for U256
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more