[]Struct oxygengine_core::ecs::hibitset::AtomicBitSet

pub struct AtomicBitSet { /* fields omitted */ }

This is similar to a BitSet but allows setting of value without unique ownership of the structure

An AtomicBitSet has the ability to add an item to the set without unique ownership (given that the set is big enough). Removing elements does require unique ownership as an effect of the hierarchy it holds. Worst case multiple writers set the same bit twice (but only is told they set it).

It is possible to atomically remove from the set, but not at the same time as atomically adding. This is because there is no way to know if layer 1-3 would be left in a consistent state if they are being cleared and set at the same time.

AtromicBitSet resolves this race by disallowing atomic clearing of bits.

Implementations

impl AtomicBitSet

pub fn new() -> AtomicBitSet

Creates an empty AtomicBitSet.

pub fn add_atomic(&self, id: u32) -> bool

Adds id to the AtomicBitSet. Returns true if the value was already in the set.

Because we cannot safely extend an AtomicBitSet without unique ownership this will panic if the Index is out of range.

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)

Clear all bits in the set

Trait Implementations

impl<T> BitAnd<T> for AtomicBitSet where
    T: BitSetLike

type Output = BitSetAnd<AtomicBitSet, T>

The resulting type after applying the & operator.

impl<'a, T> BitAnd<T> for &'a AtomicBitSet where
    T: BitSetLike

type Output = BitSetAnd<&'a AtomicBitSet, T>

The resulting type after applying the & operator.

impl<T> BitOr<T> for AtomicBitSet where
    T: BitSetLike

type Output = BitSetOr<AtomicBitSet, T>

The resulting type after applying the | operator.

impl<'a, T> BitOr<T> for &'a AtomicBitSet where
    T: BitSetLike

type Output = BitSetOr<&'a AtomicBitSet, T>

The resulting type after applying the | operator.

impl BitSetLike for AtomicBitSet

impl<'a, T> BitXor<T> for &'a AtomicBitSet where
    T: BitSetLike

type Output = BitSetXor<&'a AtomicBitSet, T>

The resulting type after applying the ^ operator.

impl<T> BitXor<T> for AtomicBitSet where
    T: BitSetLike

type Output = BitSetXor<AtomicBitSet, T>

The resulting type after applying the ^ operator.

impl Debug for AtomicBitSet

impl Default for AtomicBitSet

impl DrainableBitSet for AtomicBitSet

impl<'a> Extend<&'a u32> for AtomicBitSet

impl Extend<u32> for AtomicBitSet

impl<'a> FromIterator<&'a u32> for AtomicBitSet

impl FromIterator<u32> for AtomicBitSet

impl<'a> IntoIterator for &'a AtomicBitSet

type Item = <BitIter<&'a AtomicBitSet> as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = BitIter<&'a AtomicBitSet>

Which kind of iterator are we turning this into?

impl IntoIterator for AtomicBitSet

type Item = <BitIter<AtomicBitSet> as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = BitIter<AtomicBitSet>

Which kind of iterator are we turning this into?

impl Join for AtomicBitSet[src]

type Type = u32

Type of joined components.

type Value = ()

Type of joined storages.

type Mask = AtomicBitSet

Type of joined bit mask.

impl<'a> Join for &'a AtomicBitSet[src]

type Type = u32

Type of joined components.

type Value = ()

Type of joined storages.

type Mask = &'a AtomicBitSet

Type of joined bit mask.

impl<'a> Not for &'a AtomicBitSet

type Output = BitSetNot<&'a AtomicBitSet>

The resulting type after applying the ! operator.

impl Not for AtomicBitSet

type Output = BitSetNot<AtomicBitSet>

The resulting type after applying the ! operator.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Event for T where
    T: Send + Sync + 'static, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

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?

impl<T> Resource for T where
    T: Any, 
[src]

impl<T> TryDefault for T where
    T: Default
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,