Struct lilbits::LilBitSet
[−]
[src]
pub struct LilBitSet { /* fields omitted */ }
Set-like data structure for storing u8 elements. Cannot contains values >= 64.
Methods
impl LilBitSet
[src]
fn new() -> LilBitSet
[src]
Creates a new, empty LilBitSet
.
fn largest_allowed() -> u8
[src]
Returns the largest u8 values that IS permitted to be inserted.
fn new_from_raw(raw: u64) -> Self
[src]
Constructs a LilBitSet from a u64
. The indices of positive
bits refers to the presence of a u8 in the set. ie '...1010'
binary for 10 will represent the set {1,3}.
fn into_raw(self) -> u64
[src]
Inverse of new_from_raw
fn get(&self, element: u8) -> Option<u8>
[src]
Included only as it is a common function for the HashSet. Here it simply
wraps contains
.
Panics
panics when element > Self::largest_allowed().
fn contains(&self, element: u8) -> bool
[src]
fn is_empty(&self) -> bool
[src]
Returns true IFF the set is empty (contains no values).
fn universe() -> LilBitSet
[src]
Of course this set is not unqiue in its finite value-space for set elements. However, as there is the additional restriction of x <= Self::largest_allowed() for any element x, the UNIVERSE of missing elements can be useful
fn insert(&mut self, element: u8) -> bool
[src]
Attempts to insert the given u8
into the set. Returns true
IFF successful.
Panics
panics when element > Self::largest_allowed().
fn remove(&mut self, element: u8) -> bool
[src]
Attempts to remove a given u8
from the set. Returns true
IFF successful.
Panics
panics when element >= Self::largest_allowed().
fn union(&self, other: &Self) -> Self
[src]
Returns the set union of this, and the given LilBitSet
.
fn itersection(&self, other: &Self) -> Self
[src]
Returns the set itersection of this, and the given LilBitSet
.
fn len(&self) -> usize
[src]
Returns the set cardinality (number of elements of the set).
fn symmetric_difference(&self, other: &Self) -> Self
[src]
Returns the set symmetric difference of this, and the given LilBitSet
.
fn complement(&self) -> LilBitSet
[src]
Relying on Self::universe()
, this function can be useful in reasoning
over missing elements in a more convenient way
Trait Implementations
impl Copy for LilBitSet
[src]
impl Clone for LilBitSet
[src]
fn clone(&self) -> LilBitSet
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for LilBitSet
[src]
impl PartialEq for LilBitSet
[src]
fn eq(&self, __arg_0: &LilBitSet) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &LilBitSet) -> bool
[src]
This method tests for !=
.
impl Into<HashSet<u8>> for LilBitSet
[src]
impl Into<BTreeSet<u8>> for LilBitSet
[src]
impl Debug for LilBitSet
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
Formats the value using the given formatter.
impl IntoIterator for LilBitSet
[src]
type Item = u8
The type of the elements being iterated over.
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl FromIterator<u8> for LilBitSet
[src]
fn from_iter<I: IntoIterator<Item = u8>>(iter: I) -> Self
[src]
Creates a value from an iterator. Read more
impl<'a> FromIterator<&'a u8> for LilBitSet
[src]
fn from_iter<I: IntoIterator<Item = &'a u8>>(iter: I) -> Self
[src]
Creates a value from an iterator. Read more