pub struct U256(/* private fields */);
Implementations§
Source§impl U256
impl U256
Sourcepub const fn max_value() -> U256
pub const fn max_value() -> U256
Max value of U256: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Sourcepub fn from_str_radix(src: &str, radix: u32) -> Result<U256, U256FromStrError>
pub fn from_str_radix(src: &str, radix: u32) -> Result<U256, U256FromStrError>
U256 from string with radix 10 or 16
Sourcepub fn from_le_bytes(slice: &[u8; 32]) -> U256
pub fn from_le_bytes(slice: &[u8; 32]) -> U256
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: U256) -> Option<U256>
pub fn checked_add(self, rhs: U256) -> Option<U256>
Checked integer addition. Computes self + rhs, returning None if overflow occurred.
Sourcepub fn checked_sub(self, rhs: U256) -> Option<U256>
pub fn checked_sub(self, rhs: U256) -> Option<U256>
Checked integer subtraction. Computes self - rhs, returning None if overflow occurred.
Sourcepub fn checked_mul(self, rhs: U256) -> Option<U256>
pub fn checked_mul(self, rhs: U256) -> Option<U256>
Checked integer multiplication. Computes self * rhs, returning None if overflow occurred.
Sourcepub fn checked_div(self, rhs: U256) -> Option<U256>
pub fn checked_div(self, rhs: U256) -> Option<U256>
Checked integer division. Computes self / rhs, returning None if rhs == 0.
Sourcepub fn checked_rem(self, rhs: U256) -> Option<U256>
pub fn checked_rem(self, rhs: U256) -> Option<U256>
Checked integer remainder. Computes self % rhs, returning None if rhs == 0.
Sourcepub fn checked_shl(self, rhs: u32) -> Option<U256>
pub fn checked_shl(self, rhs: u32) -> Option<U256>
Checked integer remainder. Computes self % rhs, returning None if rhs == 0.
Sourcepub fn checked_shr(self, rhs: u32) -> Option<U256>
pub fn checked_shr(self, rhs: u32) -> Option<U256>
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>(self) -> T
pub fn down_cast_lossy<T>(self) -> T
Downcast to a an unsigned value of type T T must be at most u128
Sourcepub fn wrapping_add(self, rhs: U256) -> U256
pub fn wrapping_add(self, rhs: U256) -> U256
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: U256) -> U256
pub fn wrapping_sub(self, rhs: U256) -> U256
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: U256) -> U256
pub fn wrapping_mul(self, rhs: U256) -> U256
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) -> U256
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: U256)
fn add_assign(&mut self, rhs: U256)
+=
operation. Read moreSource§impl BitAndAssign for U256
impl BitAndAssign for U256
Source§fn bitand_assign(&mut self, rhs: U256)
fn bitand_assign(&mut self, rhs: U256)
&=
operation. Read moreSource§impl<'de> Deserialize<'de> for U256
impl<'de> Deserialize<'de> for U256
Source§fn deserialize<D>(
deserializer: D,
) -> Result<U256, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<U256, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl DivAssign for U256
impl DivAssign for U256
Source§fn div_assign(&mut self, rhs: U256)
fn div_assign(&mut self, rhs: U256)
/=
operation. Read moreSource§impl MulAssign for U256
impl MulAssign for U256
Source§fn mul_assign(&mut self, rhs: U256)
fn mul_assign(&mut self, rhs: U256)
*=
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: U256)
fn rem_assign(&mut self, rhs: U256)
%=
operation. Read moreSource§impl SampleUniform for U256
impl SampleUniform for U256
Source§type Sampler = UniformU256
type Sampler = UniformU256
UniformSampler
implementation supporting type X
.Source§impl Serialize for U256
impl Serialize for U256
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl SubAssign for U256
impl SubAssign for U256
Source§fn sub_assign(&mut self, rhs: U256)
fn sub_assign(&mut self, rhs: U256)
-=
operation. Read moreimpl Copy for U256
impl Eq for U256
impl StructuralPartialEq for U256
Auto Trait Implementations§
impl Freeze for U256
impl RefUnwindSafe for U256
impl Send for U256
impl Sync for U256
impl Unpin for U256
impl UnwindSafe for U256
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<Borrowed> SampleBorrow<Borrowed> for Borrowedwhere
Borrowed: SampleUniform,
impl<Borrowed> SampleBorrow<Borrowed> for Borrowedwhere
Borrowed: SampleUniform,
Source§fn borrow(&self) -> &Borrowed
fn borrow(&self) -> &Borrowed
Borrow::borrow