Trait oxygengine_core::ecs::hibitset::BitSetLike [−]
pub trait BitSetLike { pub fn layer3(&self) -> usize; pub fn layer2(&self, i: usize) -> usize; pub fn layer1(&self, i: usize) -> usize; pub fn layer0(&self, i: usize) -> usize; pub fn contains(&self, i: u32) -> bool; pub fn get_from_layer(&self, layer: usize, idx: usize) -> usize { ... } pub fn is_empty(&self) -> bool { ... } pub fn iter(self) -> BitIter<Self>ⓘ { ... } }
A generic interface for BitSetLike
-like types.
Every BitSetLike
is hierarchical, meaning that there
are multiple levels that branch out in a tree like structure.
Layer0 each bit represents one Index of the set
Layer1 each bit represents one usize
of Layer0, and will be
set only if the word below it is not zero.
Layer2 has the same arrangement but with Layer1, and Layer3 with Layer2.
This arrangement allows for rapid jumps across the key-space.
Required methods
pub fn layer3(&self) -> usize
Return a usize
where each bit represents if any word in layer2
has been set.
pub fn layer2(&self, i: usize) -> usize
Return the usize
from the array of usizes that indicates if any
bit has been set in layer1
pub fn layer1(&self, i: usize) -> usize
Return the usize
from the array of usizes that indicates if any
bit has been set in layer0
pub fn layer0(&self, i: usize) -> usize
Return a usize
that maps to the direct 1:1 association with
each index of the set
pub fn contains(&self, i: u32) -> bool
Allows checking if set bit is contained in the bit set.
Provided methods
pub fn get_from_layer(&self, layer: usize, idx: usize) -> usize
Gets the usize
corresponding to layer and index.
The layer
should be in the range [0, 3]
pub fn is_empty(&self) -> bool
Returns true if this BitSetLike
contains nothing, and false otherwise.
pub fn iter(self) -> BitIter<Self>ⓘ
Create an iterator that will scan over the keyspace
Trait Implementations
impl<'a> Join for &'a (dyn BitSetLike + 'a)
[src]
impl<'a> Join for &'a (dyn BitSetLike + 'a)
[src]type Type = u32
Type of joined components.
type Value = ()
Type of joined storages.
type Mask = &'a (dyn BitSetLike + 'a)
Type of joined bit mask.
pub unsafe fn open(
self
) -> (<&'a (dyn BitSetLike + 'a) as Join>::Mask, <&'a (dyn BitSetLike + 'a) as Join>::Value)
[src]
self
) -> (<&'a (dyn BitSetLike + 'a) as Join>::Mask, <&'a (dyn BitSetLike + 'a) as Join>::Value)
pub unsafe fn get(
&mut <&'a (dyn BitSetLike + 'a) as Join>::Value,
id: u32
) -> <&'a (dyn BitSetLike + 'a) as Join>::Type
[src]
&mut <&'a (dyn BitSetLike + 'a) as Join>::Value,
id: u32
) -> <&'a (dyn BitSetLike + 'a) as Join>::Type
pub fn join(self) -> JoinIter<Self>ⓘ
[src]
pub fn maybe(self) -> MaybeJoin<Self>
[src]
pub fn is_unconstrained() -> bool
[src]
Implementations on Foreign Types
impl<'a, T> BitSetLike for &'a T where
T: BitSetLike + ?Sized,
impl<'a, T> BitSetLike for &'a T where
T: BitSetLike + ?Sized,
impl<'a, T> BitSetLike for &'a mut T where
T: BitSetLike + ?Sized,
impl<'a, T> BitSetLike for &'a mut T where
T: BitSetLike + ?Sized,
Implementors
impl BitSetLike for BitSet
impl BitSetLike for BitSet
impl BitSetLike for AtomicBitSet
impl BitSetLike for AtomicBitSet
impl BitSetLike for BitSetAll
impl BitSetLike for BitSetAll
impl<A> BitSetLike for BitSetNot<A> where
A: BitSetLike,
impl<A> BitSetLike for BitSetNot<A> where
A: BitSetLike,
impl<A, B> BitSetLike for BitSetAnd<A, B> where
A: BitSetLike,
B: BitSetLike,
impl<A, B> BitSetLike for BitSetAnd<A, B> where
A: BitSetLike,
B: BitSetLike,
impl<A, B> BitSetLike for BitSetOr<A, B> where
A: BitSetLike,
B: BitSetLike,
impl<A, B> BitSetLike for BitSetOr<A, B> where
A: BitSetLike,
B: BitSetLike,