pub struct BitIdx(pub u8);
Tuple Fields§
§0: u8
Implementations§
source§impl BitIdx
impl BitIdx
sourcepub fn of_single_set_bit(x: u32) -> Option<Self>
pub fn of_single_set_bit(x: u32) -> Option<Self>
Returns Some(BitIdx(i))
if and only if x == (1 << i)
.
sourcepub fn of_all_set_bits(x: u32) -> impl Iterator<Item = Self>
pub fn of_all_set_bits(x: u32) -> impl Iterator<Item = Self>
Returns an iterator of BitIdx
s, from which x
can be reconstructed
by OR-ing together 1 << i
for every BitIdx(i)
.
The iterator is ordered: lower bit indices appear before higher ones.
Trait Implementations§
source§impl PartialEq<BitIdx> for BitIdx
impl PartialEq<BitIdx> for BitIdx
impl Copy for BitIdx
impl Eq for BitIdx
impl StructuralEq for BitIdx
impl StructuralPartialEq for BitIdx
Auto Trait Implementations§
impl RefUnwindSafe for BitIdx
impl Send for BitIdx
impl Sync for BitIdx
impl Unpin for BitIdx
impl UnwindSafe for BitIdx
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.