pub enum Bit {
Zero,
One,
}Expand description
Enum representing all possible states of a bit in a Bitset.
Variants are re-exported and don’t require Bit:: prefix.
Closely resembles bool type. Implements From<bool>,
and bool implements From<Bit>, if such conversion is needed.
§Examples
use bitworks::{bit::*, prelude::{Bitset, Bitset8}};
assert_eq!(!One, Zero);
assert_eq!(One | Zero, One);
assert_eq!(One & Zero, Zero);
assert_eq!(One ^ Zero, One);
assert_eq!(One ^ One, Zero);
let bitset = Bitset8::NONE
.replace(0.try_into()?, One)
.build();
assert_eq!(bitset.into_inner(), 0b00000001);Variants§
Trait Implementations§
Source§impl BitAndAssign for Bit
impl BitAndAssign for Bit
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the
&= operation. Read moreSource§impl BitOrAssign for Bit
impl BitOrAssign for Bit
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|= operation. Read moreSource§impl BitXorAssign for Bit
impl BitXorAssign for Bit
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
Performs the
^= operation. Read moreSource§impl FromIterator<Bit> for Bitset128
impl FromIterator<Bit> for Bitset128
Source§impl FromIterator<Bit> for Bitset16
impl FromIterator<Bit> for Bitset16
Source§impl FromIterator<Bit> for Bitset32
impl FromIterator<Bit> for Bitset32
Source§impl FromIterator<Bit> for Bitset64
impl FromIterator<Bit> for Bitset64
Source§impl FromIterator<Bit> for Bitset8
impl FromIterator<Bit> for Bitset8
Source§impl Ord for Bit
impl Ord for Bit
Source§impl PartialOrd for Bit
impl PartialOrd for Bit
impl Copy for Bit
impl Eq for Bit
impl StructuralPartialEq for Bit
Auto Trait Implementations§
impl Freeze for Bit
impl RefUnwindSafe for Bit
impl Send for Bit
impl Sync for Bit
impl Unpin for Bit
impl UnwindSafe for Bit
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
Mutably borrows from an owned value. Read more