pub struct Bits<const BITS: usize, const LIMBS: usize>(/* private fields */);
Expand description
A newtype wrapper around Uint
that restricts operations to those
relevant for bit arrays.
Implementations§
Source§impl<const BITS: usize, const LIMBS: usize> Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> Bits<BITS, LIMBS>
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) -> Self
pub fn reverse_bits(self) -> Self
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<Self>
pub fn checked_shl(self, rhs: usize) -> Option<Self>
See Uint::checked_shl
for documentation.
Sourcepub fn checked_shr(self, rhs: usize) -> Option<Self>
pub fn checked_shr(self, rhs: usize) -> Option<Self>
See Uint::checked_shr
for documentation.
Sourcepub fn overflowing_shl(self, rhs: usize) -> (Self, bool)
pub fn overflowing_shl(self, rhs: usize) -> (Self, bool)
See Uint::overflowing_shl
for documentation.
Sourcepub fn overflowing_shr(self, rhs: usize) -> (Self, bool)
pub fn overflowing_shr(self, rhs: usize) -> (Self, bool)
See Uint::overflowing_shr
for documentation.
Sourcepub fn wrapping_shl(self, rhs: usize) -> Self
pub fn wrapping_shl(self, rhs: usize) -> Self
See Uint::wrapping_shl
for documentation.
Sourcepub fn wrapping_shr(self, rhs: usize) -> Self
pub fn wrapping_shr(self, rhs: usize) -> Self
See Uint::wrapping_shr
for documentation.
Sourcepub fn rotate_left(self, rhs: usize) -> Self
pub fn rotate_left(self, rhs: usize) -> Self
See Uint::rotate_left
for documentation.
Sourcepub fn rotate_right(self, rhs: usize) -> Self
pub fn rotate_right(self, rhs: usize) -> Self
See Uint::rotate_right
for documentation.
Sourcepub fn try_from_be_slice(bytes: &[u8]) -> Option<Self>
pub fn try_from_be_slice(bytes: &[u8]) -> Option<Self>
See Uint::try_from_be_slice
for documentation.
Sourcepub fn try_from_le_slice(bytes: &[u8]) -> Option<Self>
pub fn try_from_le_slice(bytes: &[u8]) -> Option<Self>
See Uint::try_from_le_slice
for documentation.
Sourcepub fn from_str_radix(src: &str, radix: u64) -> Result<Self, ParseError>
pub fn from_str_radix(src: &str, radix: u64) -> Result<Self, ParseError>
See Uint::from_str_radix
for documentation.
Sourcepub fn from_be_bytes<const BYTES: usize>(bytes: [u8; BYTES]) -> Self
pub fn from_be_bytes<const BYTES: usize>(bytes: [u8; BYTES]) -> Self
See Uint::from_be_bytes
for documentation.
Sourcepub fn from_le_bytes<const BYTES: usize>(bytes: [u8; BYTES]) -> Self
pub fn from_le_bytes<const BYTES: usize>(bytes: [u8; BYTES]) -> Self
See Uint::from_le_bytes
for documentation.
Sourcepub const fn from_limbs(limbs: [u64; LIMBS]) -> Self
pub const fn from_limbs(limbs: [u64; LIMBS]) -> Self
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.
Trait Implementations§
Source§impl<const BITS: usize, const LIMBS: usize> BitAnd<&Bits<BITS, LIMBS>> for &Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitAnd<&Bits<BITS, LIMBS>> for &Bits<BITS, LIMBS>
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> BitXor<&Bits<BITS, LIMBS>> for &Bits<BITS, LIMBS>
impl<const BITS: usize, const LIMBS: usize> BitXor<&Bits<BITS, LIMBS>> for &Bits<BITS, LIMBS>
Source§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<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