Struct hibitset::BitSet
[−]
[src]
pub struct BitSet { /* fields omitted */ }
A BitSet
is a simple set designed to track entity indices for which
a certain component exists. It does not track the Generation
of the
entities that it contains.
Note, a BitSet
is limited by design to only 1,048,576
indices.
Adding beyond this limit will cause the BitSet
to panic.
Methods
impl BitSet
[src]
fn new() -> BitSet
Creates an empty BitSet
.
fn with_capacity(max: u32) -> BitSet
Creates an empty BitSet
, preallocated for up to max
indices.
fn add(&mut self, id: u32) -> bool
Adds id
to the BitSet
. Returns true
if the value was
already in the set.
fn remove(&mut self, id: u32) -> bool
Removes id
from the set, returns true
if the value
was removed, and false
if the value was not set
to begin with.
fn contains(&self, id: u32) -> bool
Returns true
if id
is in the set.
fn clear(&mut self)
Completely wipes out the bit set.
Trait Implementations
impl Clone for BitSet
[src]
fn clone(&self) -> BitSet
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for BitSet
[src]
impl Default for BitSet
[src]
impl BitSetLike for BitSet
[src]
fn layer3(&self) -> usize
Return a usize where each bit represents if any word in layer2 has been set. Read more
fn layer2(&self, i: usize) -> usize
Return the usize from the array of usizes that indicates if any bit has been set in layer1 Read more
fn layer1(&self, i: usize) -> usize
Return the usize from the array of usizes that indicates if any bit has been set in layer0 Read more
fn layer0(&self, i: usize) -> usize
Return a usize that maps to the direct 1:1 association with each index of the set Read more
fn iter(self) -> BitIter<Self> where
Self: Sized,
Self: Sized,
Create an iterator that will scan over the keyspace
fn par_iter(self) -> BitParIter<Self> where
Self: Sized,
Self: Sized,
Create a parallel iterator that will scan over the keyspace