pub type B256 = Bits<256, 4>;
Expand description
Bits
for 256
bits.
Aliased Type§
struct B256(/* private fields */);
Implementations
Source§impl<const BITS: usize, const LIMBS: usize> Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Bits<BITS, LIMBS>
Sourcepub fn reverse_bits(self) -> Bits<BITS, LIMBS>
pub fn reverse_bits(self) -> Bits<BITS, LIMBS>
See Uint::reverse_bits
for documentation.
Sourcepub fn as_le_bytes(&self) -> Cow<'_, [u8]>
pub fn as_le_bytes(&self) -> Cow<'_, [u8]>
See Uint::as_le_bytes
for documentation.
Sourcepub fn to_be_bytes_vec(&self) -> Vec<u8> ⓘ
pub fn to_be_bytes_vec(&self) -> Vec<u8> ⓘ
See Uint::to_be_bytes_vec
for documentation.
Sourcepub fn to_le_bytes<const BYTES: usize>(&self) -> [u8; BYTES]
pub fn to_le_bytes<const BYTES: usize>(&self) -> [u8; BYTES]
See Uint::to_le_bytes
for documentation.
Sourcepub fn to_be_bytes<const BYTES: usize>(&self) -> [u8; BYTES]
pub fn to_be_bytes<const BYTES: usize>(&self) -> [u8; BYTES]
See Uint::to_be_bytes
for documentation.
Sourcepub fn leading_zeros(&self) -> usize
pub fn leading_zeros(&self) -> usize
See Uint::leading_zeros
for documentation.
Sourcepub fn leading_ones(&self) -> usize
pub fn leading_ones(&self) -> usize
See Uint::leading_ones
for documentation.
Sourcepub fn trailing_zeros(&self) -> usize
pub fn trailing_zeros(&self) -> usize
See Uint::trailing_zeros
for documentation.
Sourcepub fn trailing_ones(&self) -> usize
pub fn trailing_ones(&self) -> usize
See Uint::trailing_ones
for documentation.
Sourcepub unsafe fn as_limbs_mut(&mut self) -> &mut [u64; LIMBS]
pub unsafe fn as_limbs_mut(&mut self) -> &mut [u64; LIMBS]
See Uint::as_limbs_mut
for documentation.
Sourcepub fn checked_shl(self, rhs: usize) -> Option<Bits<BITS, LIMBS>>
pub fn checked_shl(self, rhs: usize) -> Option<Bits<BITS, LIMBS>>
See Uint::checked_shl
for documentation.
Sourcepub fn checked_shr(self, rhs: usize) -> Option<Bits<BITS, LIMBS>>
pub fn checked_shr(self, rhs: usize) -> Option<Bits<BITS, LIMBS>>
See Uint::checked_shr
for documentation.
Sourcepub fn overflowing_shl(self, rhs: usize) -> (Bits<BITS, LIMBS>, bool)
pub fn overflowing_shl(self, rhs: usize) -> (Bits<BITS, LIMBS>, bool)
See Uint::overflowing_shl
for documentation.
Sourcepub fn overflowing_shr(self, rhs: usize) -> (Bits<BITS, LIMBS>, bool)
pub fn overflowing_shr(self, rhs: usize) -> (Bits<BITS, LIMBS>, bool)
See Uint::overflowing_shr
for documentation.
Sourcepub fn wrapping_shl(self, rhs: usize) -> Bits<BITS, LIMBS>
pub fn wrapping_shl(self, rhs: usize) -> Bits<BITS, LIMBS>
See Uint::wrapping_shl
for documentation.
Sourcepub fn wrapping_shr(self, rhs: usize) -> Bits<BITS, LIMBS>
pub fn wrapping_shr(self, rhs: usize) -> Bits<BITS, LIMBS>
See Uint::wrapping_shr
for documentation.
Sourcepub fn rotate_left(self, rhs: usize) -> Bits<BITS, LIMBS>
pub fn rotate_left(self, rhs: usize) -> Bits<BITS, LIMBS>
See Uint::rotate_left
for documentation.
Sourcepub fn rotate_right(self, rhs: usize) -> Bits<BITS, LIMBS>
pub fn rotate_right(self, rhs: usize) -> Bits<BITS, LIMBS>
See Uint::rotate_right
for documentation.
Sourcepub fn try_from_be_slice(bytes: &[u8]) -> Option<Bits<BITS, LIMBS>>
pub fn try_from_be_slice(bytes: &[u8]) -> Option<Bits<BITS, LIMBS>>
See Uint::try_from_be_slice
for documentation.
Sourcepub fn try_from_le_slice(bytes: &[u8]) -> Option<Bits<BITS, LIMBS>>
pub fn try_from_le_slice(bytes: &[u8]) -> Option<Bits<BITS, LIMBS>>
See Uint::try_from_le_slice
for documentation.
Sourcepub fn from_str_radix(
src: &str,
radix: u64,
) -> Result<Bits<BITS, LIMBS>, ParseError>
pub fn from_str_radix( src: &str, radix: u64, ) -> Result<Bits<BITS, LIMBS>, ParseError>
See Uint::from_str_radix
for documentation.
Sourcepub fn from_be_bytes<const BYTES: usize>(
bytes: [u8; BYTES],
) -> Bits<BITS, LIMBS>
pub fn from_be_bytes<const BYTES: usize>( bytes: [u8; BYTES], ) -> Bits<BITS, LIMBS>
See Uint::from_be_bytes
for documentation.
Sourcepub fn from_le_bytes<const BYTES: usize>(
bytes: [u8; BYTES],
) -> Bits<BITS, LIMBS>
pub fn from_le_bytes<const BYTES: usize>( bytes: [u8; BYTES], ) -> Bits<BITS, LIMBS>
See Uint::from_le_bytes
for documentation.
Sourcepub const fn from_limbs(limbs: [u64; LIMBS]) -> Bits<BITS, LIMBS>
pub const fn from_limbs(limbs: [u64; LIMBS]) -> Bits<BITS, LIMBS>
See Uint::from_limbs
for documentation.
Sourcepub const fn as_limbs(&self) -> &[u64; LIMBS]
pub const fn as_limbs(&self) -> &[u64; LIMBS]
See Uint::as_limbs
for documentation.
Source§impl<const BITS: usize, const LIMBS: usize> Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Bits<BITS, LIMBS>
Sourcepub const LIMBS: usize = Uint<BITS, LIMBS>::LIMBS
pub const LIMBS: usize = Uint<BITS, LIMBS>::LIMBS
The size of this integer type in 64-bit limbs.
Sourcepub const ZERO: Bits<BITS, LIMBS>
pub const ZERO: Bits<BITS, LIMBS>
The value zero. This is the only value that exists in all Uint
types.
Sourcepub const fn into_inner(self) -> Uint<BITS, LIMBS>
pub const fn into_inner(self) -> Uint<BITS, LIMBS>
Returns the inner Uint.
Sourcepub fn as_uint_mut(&mut self) -> &mut Uint<BITS, LIMBS>
pub fn as_uint_mut(&mut self) -> &mut Uint<BITS, LIMBS>
Returns a mutable reference to the inner Uint.
Trait Implementations
Source§impl<const BITS: usize, const LIMBS: usize> BitAndAssign<&Bits<BITS, LIMBS>> for Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitAndAssign<&Bits<BITS, LIMBS>> for Bits<BITS, LIMBS>
Source§fn bitand_assign(&mut self, rhs: &Bits<BITS, LIMBS>)
fn bitand_assign(&mut self, rhs: &Bits<BITS, LIMBS>)
&=
operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> BitAndAssign for Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitAndAssign for Bits<BITS, LIMBS>
Source§fn bitand_assign(&mut self, rhs: Bits<BITS, LIMBS>)
fn bitand_assign(&mut self, rhs: Bits<BITS, LIMBS>)
&=
operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> BitOrAssign<&Bits<BITS, LIMBS>> for Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitOrAssign<&Bits<BITS, LIMBS>> for Bits<BITS, LIMBS>
Source§fn bitor_assign(&mut self, rhs: &Bits<BITS, LIMBS>)
fn bitor_assign(&mut self, rhs: &Bits<BITS, LIMBS>)
|=
operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> BitOrAssign for Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitOrAssign for Bits<BITS, LIMBS>
Source§fn bitor_assign(&mut self, rhs: Bits<BITS, LIMBS>)
fn bitor_assign(&mut self, rhs: Bits<BITS, LIMBS>)
|=
operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> BitXorAssign<&Bits<BITS, LIMBS>> for Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitXorAssign<&Bits<BITS, LIMBS>> for Bits<BITS, LIMBS>
Source§fn bitxor_assign(&mut self, rhs: &Bits<BITS, LIMBS>)
fn bitxor_assign(&mut self, rhs: &Bits<BITS, LIMBS>)
^=
operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> BitXorAssign for Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitXorAssign for Bits<BITS, LIMBS>
Source§fn bitxor_assign(&mut self, rhs: Bits<BITS, LIMBS>)
fn bitxor_assign(&mut self, rhs: Bits<BITS, LIMBS>)
^=
operation. Read moreSource§impl<'de, const BITS: usize, const LIMBS: usize> Deserialize<'de> for Bits<BITS, LIMBS>
impl<'de, const BITS: usize, const LIMBS: usize> Deserialize<'de> for Bits<BITS, LIMBS>
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Bits<BITS, LIMBS>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Bits<BITS, LIMBS>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl<const BITS: usize, const LIMBS: usize> Serialize for Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Serialize for Bits<BITS, LIMBS>
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<const BITS: usize, const LIMBS: usize> ShlAssign<&usize> for Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<&usize> for Bits<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: &usize)
fn shl_assign(&mut self, rhs: &usize)
<<=
operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShlAssign<usize> for Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShlAssign<usize> for Bits<BITS, LIMBS>
Source§fn shl_assign(&mut self, rhs: usize)
fn shl_assign(&mut self, rhs: usize)
<<=
operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<&usize> for Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<&usize> for Bits<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: &usize)
fn shr_assign(&mut self, rhs: &usize)
>>=
operation. Read moreSource§impl<const BITS: usize, const LIMBS: usize> ShrAssign<usize> for Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> ShrAssign<usize> for Bits<BITS, LIMBS>
Source§fn shr_assign(&mut self, rhs: usize)
fn shr_assign(&mut self, rhs: usize)
>>=
operation. Read more