[−]Struct oxygengine::prelude::BitSet
A BitSet
is a simple set designed to track which indices are placed
into it.
Note, a BitSet
is limited by design to only usize**4
indices.
Adding beyond this limit will cause the BitSet
to panic.
Methods
impl BitSet
pub fn new() -> BitSet
Creates an empty BitSet
.
pub fn with_capacity(max: u32) -> BitSet
Creates an empty BitSet
, preallocated for up to max
indices.
pub fn add(&mut self, id: u32) -> bool
Adds id
to the BitSet
. Returns true
if the value was
already in the set.
pub 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.
pub fn contains(&self, id: u32) -> bool
Returns true
if id
is in the set.
pub fn clear(&mut self)
Completely wipes out the bit set.
Trait Implementations
impl Join for BitSet
type Type = u32
Type of joined components.
type Value = ()
Type of joined storages.
type Mask = BitSet
Type of joined bit mask.
unsafe fn open(self) -> (<BitSet as Join>::Mask, <BitSet as Join>::Value)
unsafe fn get(&mut <BitSet as Join>::Value, id: u32) -> <BitSet as Join>::Type
ⓘImportant traits for JoinIter<J>fn join(self) -> JoinIter<Self>
Create a joined iterator over the contents.
fn maybe(self) -> MaybeJoin<Self>
Returns a Join
-able structure that yields all indices, returning None
for all missing elements and Some(T)
for found elements. Read more
fn is_unconstrained() -> bool
If this Join
typically returns all indices in the mask, then iterating over only it or combined with other joins that are also dangerous will cause the JoinIter
/ParJoin
to go through all indices which is usually not what is wanted and will kill performance. Read more
impl<'a> Join for &'a BitSet
type Type = u32
Type of joined components.
type Value = ()
Type of joined storages.
type Mask = &'a BitSet
Type of joined bit mask.
unsafe fn open(
self
) -> (<&'a BitSet as Join>::Mask, <&'a BitSet as Join>::Value)
self
) -> (<&'a BitSet as Join>::Mask, <&'a BitSet as Join>::Value)
unsafe fn get(
&mut <&'a BitSet as Join>::Value,
id: u32
) -> <&'a BitSet as Join>::Type
&mut <&'a BitSet as Join>::Value,
id: u32
) -> <&'a BitSet as Join>::Type
ⓘImportant traits for JoinIter<J>fn join(self) -> JoinIter<Self>
Create a joined iterator over the contents.
fn maybe(self) -> MaybeJoin<Self>
Returns a Join
-able structure that yields all indices, returning None
for all missing elements and Some(T)
for found elements. Read more
fn is_unconstrained() -> bool
If this Join
typically returns all indices in the mask, then iterating over only it or combined with other joins that are also dangerous will cause the JoinIter
/ParJoin
to go through all indices which is usually not what is wanted and will kill performance. Read more
impl DrainableBitSet for BitSet
fn remove(&mut self, i: u32) -> bool
fn drain(&'a mut self) -> DrainBitIter<'a, Self>
Create a draining iterator that will scan over the keyspace and clears it while doing so.
impl<T> BitAnd<T> for BitSet where
T: BitSetLike,
T: BitSetLike,
type Output = BitSetAnd<BitSet, T>
The resulting type after applying the &
operator.
fn bitand(self, rhs: T) -> <BitSet as BitAnd<T>>::Output
impl<'a, T> BitAnd<T> for &'a BitSet where
T: BitSetLike,
T: BitSetLike,
type Output = BitSetAnd<&'a BitSet, T>
The resulting type after applying the &
operator.
fn bitand(self, rhs: T) -> <&'a BitSet as BitAnd<T>>::Output
impl Clone for BitSet
fn clone(&self) -> BitSet
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a, B> BitOrAssign<&'a B> for BitSet where
B: BitSetLike,
B: BitSetLike,
fn bitor_assign(&mut self, lhs: &B)
impl<'a> IntoIterator for &'a BitSet
type Item = <BitIter<&'a BitSet> as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = BitIter<&'a BitSet>
Which kind of iterator are we turning this into?
fn into_iter(self) -> <&'a BitSet as IntoIterator>::IntoIter
impl IntoIterator for BitSet
type Item = <BitIter<BitSet> as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = BitIter<BitSet>
Which kind of iterator are we turning this into?
fn into_iter(self) -> <BitSet as IntoIterator>::IntoIter
impl BitSetLike for BitSet
fn layer3(&self) -> usize
fn layer2(&self, i: usize) -> usize
fn layer1(&self, i: usize) -> usize
fn layer0(&self, i: usize) -> usize
fn contains(&self, i: u32) -> bool
fn get_from_layer(&self, layer: usize, idx: usize) -> usize
Gets the usize
corresponding to layer and index. Read more
fn is_empty(&self) -> bool
Returns true if this BitSetLike
contains nothing, and false otherwise.
fn iter(self) -> BitIter<Self>
Create an iterator that will scan over the keyspace
impl<'a, B> BitAndAssign<&'a B> for BitSet where
B: BitSetLike,
B: BitSetLike,
fn bitand_assign(&mut self, lhs: &B)
impl FromIterator<u32> for BitSet
fn from_iter<T>(iter: T) -> BitSet where
T: IntoIterator<Item = u32>,
T: IntoIterator<Item = u32>,
impl<'a> FromIterator<&'a u32> for BitSet
fn from_iter<T>(iter: T) -> BitSet where
T: IntoIterator<Item = &'a u32>,
T: IntoIterator<Item = &'a u32>,
impl<'a, T> BitOr<T> for &'a BitSet where
T: BitSetLike,
T: BitSetLike,
type Output = BitSetOr<&'a BitSet, T>
The resulting type after applying the |
operator.
fn bitor(self, rhs: T) -> <&'a BitSet as BitOr<T>>::Output
impl<T> BitOr<T> for BitSet where
T: BitSetLike,
T: BitSetLike,
type Output = BitSetOr<BitSet, T>
The resulting type after applying the |
operator.
fn bitor(self, rhs: T) -> <BitSet as BitOr<T>>::Output
impl<'a, T> BitXor<T> for &'a BitSet where
T: BitSetLike,
T: BitSetLike,
type Output = BitSetXor<&'a BitSet, T>
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: T) -> <&'a BitSet as BitXor<T>>::Output
impl<T> BitXor<T> for BitSet where
T: BitSetLike,
T: BitSetLike,
type Output = BitSetXor<BitSet, T>
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: T) -> <BitSet as BitXor<T>>::Output
impl Extend<u32> for BitSet
fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = u32>,
T: IntoIterator<Item = u32>,
impl<'a> Extend<&'a u32> for BitSet
fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = &'a u32>,
T: IntoIterator<Item = &'a u32>,
impl Default for BitSet
impl Debug for BitSet
impl Not for BitSet
type Output = BitSetNot<BitSet>
The resulting type after applying the !
operator.
fn not(self) -> <BitSet as Not>::Output
impl<'a> Not for &'a BitSet
type Output = BitSetNot<&'a BitSet>
The resulting type after applying the !
operator.
fn not(self) -> <&'a BitSet as Not>::Output
impl<'a, B> BitXorAssign<&'a B> for BitSet where
B: BitSetLike,
B: BitSetLike,
fn bitxor_assign(&mut self, lhs: &B)
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: Any,
T: Any,
fn get_type_id(&self) -> TypeId
impl<T> Resource for T where
T: Any + Send + Sync,
T: Any + Send + Sync,
impl<T> TryDefault for T where
T: Default,
T: Default,
fn try_default() -> Result<T, String>
fn unwrap_default() -> Self
Calls try_default
and panics on an error case.
impl<T> Event for T where
T: Send + Sync + 'static,
T: Send + Sync + 'static,