Trait bit_collection::BitCollection
[−]
[src]
pub trait BitCollection: DoubleEndedIterator + ExactSizeIterator { fn full() -> Self; fn empty() -> Self; fn is_empty(&self) -> bool; unsafe fn lsb_unchecked(&self) -> Self::Item; unsafe fn msb_unchecked(&self) -> Self::Item; fn remove_lsb(&mut self); fn remove_msb(&mut self); fn pop_lsb(&mut self) -> Option<Self::Item>; fn pop_msb(&mut self) -> Option<Self::Item>; fn contains<T: Into<Self>>(&self, _: T) -> bool
where
Self: Sized; fn removing<T: Into<Self>>(self, _: T) -> Self
where
Self: Sized; fn inserting<T: Into<Self>>(self, _: T) -> Self
where
Self: Sized; fn toggling<T: Into<Self>>(self, _: T) -> Self
where
Self: Sized; fn intersecting<T: Into<Self>>(self, _: T) -> Self
where
Self: Sized; fn remove<T: Into<Self>>(&mut self, _: T)
where
Self: Sized; fn insert<T: Into<Self>>(&mut self, _: T)
where
Self: Sized; fn toggle<T: Into<Self>>(&mut self, _: T)
where
Self: Sized; fn intersect<T: Into<Self>>(&mut self, _: T)
where
Self: Sized; fn lsb(&self) -> Option<Self::Item> { ... } fn msb(&self) -> Option<Self::Item> { ... } fn setting<T: Into<Self>>(self, x: T, condition: bool) -> Self
where
Self: Sized, { ... } fn set<T: Into<Self>>(&mut self, x: T, condition: bool)
where
Self: Sized, { ... } }
A type that represents a collection of bits that can be iterated over.
Required Methods
fn full() -> Self
Returns a full instance with all bits set.
fn empty() -> Self
Returns an empty instance with no bits set.
fn is_empty(&self) -> bool
Returns whether self
is empty.
unsafe fn lsb_unchecked(&self) -> Self::Item
Returns the least significant bit in self
without checking whether
self
is empty.
unsafe fn msb_unchecked(&self) -> Self::Item
Returns the most significant bit in self
without checking whether
self
is empty.
fn remove_lsb(&mut self)
Removes the least significant bit from self
.
fn remove_msb(&mut self)
Removes the most significant bit from self
.
fn pop_lsb(&mut self) -> Option<Self::Item>
Removes the least significant bit from self
and returns it.
fn pop_msb(&mut self) -> Option<Self::Item>
Removes the most significant bit from self
and returns it.
fn contains<T: Into<Self>>(&self, _: T) -> bool where
Self: Sized,
Self: Sized,
Returns whether self
contains the value.
fn removing<T: Into<Self>>(self, _: T) -> Self where
Self: Sized,
Self: Sized,
Returns the result of removing the value from self
.
fn inserting<T: Into<Self>>(self, _: T) -> Self where
Self: Sized,
Self: Sized,
Returns the result of inserting the value into self
.
fn toggling<T: Into<Self>>(self, _: T) -> Self where
Self: Sized,
Self: Sized,
Returns the result of toggling the bits of the value in self
.
fn intersecting<T: Into<Self>>(self, _: T) -> Self where
Self: Sized,
Self: Sized,
Returns the result of intersecting the bits of the value with self
.
fn remove<T: Into<Self>>(&mut self, _: T) where
Self: Sized,
Self: Sized,
Removes the value from self
.
fn insert<T: Into<Self>>(&mut self, _: T) where
Self: Sized,
Self: Sized,
Inserts the value into self
.
fn toggle<T: Into<Self>>(&mut self, _: T) where
Self: Sized,
Self: Sized,
Toggles bits of the value in self
.
fn intersect<T: Into<Self>>(&mut self, _: T) where
Self: Sized,
Self: Sized,
Intersects the bits of the value with self
.
Provided Methods
fn lsb(&self) -> Option<Self::Item>
Returns the least significant bit in self
if self
is not empty.
fn msb(&self) -> Option<Self::Item>
Returns the most significant bit in self
if self
is not empty.
fn setting<T: Into<Self>>(self, x: T, condition: bool) -> Self where
Self: Sized,
Self: Sized,
Returns the result of setting the bits of the value in self
based on
condition
.
fn set<T: Into<Self>>(&mut self, x: T, condition: bool) where
Self: Sized,
Self: Sized,
Sets the bits of the value in self
based on condition
.