[][src]Struct goggles::masked::MaskedStorage

pub struct MaskedStorage<S: RawStorage> { /* fields omitted */ }

Wraps a RawStorage for some component with a BitSet mask to provide a safe, Join-able interface for component storage.

Implementations

impl<S: RawStorage> MaskedStorage<S>[src]

pub fn mask(&self) -> &BitSet[src]

pub fn raw_storage(&self) -> &S[src]

pub fn raw_storage_mut(&mut self) -> &mut S[src]

pub fn contains(&self, index: Index) -> bool[src]

pub fn get(&self, index: Index) -> Option<&S::Item>[src]

pub fn get_mut(&mut self, index: Index) -> Option<&mut S::Item>[src]

pub fn get_or_insert_with(
    &mut self,
    index: Index,
    f: impl FnOnce() -> S::Item
) -> &mut S::Item
[src]

pub fn insert(&mut self, index: Index, v: S::Item) -> Option<S::Item>[src]

pub fn update(&mut self, index: Index, v: S::Item) -> Option<S::Item> where
    S::Item: PartialEq
[src]

Update the value at this index only if it has changed.

This is useful when combined with FlaggedStorage, which keeps track of modified components. By using this method, you can avoid flagging changes unnecessarily when the new value of the component is equal to the old one.

pub fn remove(&mut self, index: Index) -> Option<S::Item>[src]

pub fn guard(&mut self) -> GuardedJoin<'_, S>[src]

Returns an IntoJoin type whose values are GuardedJoin wrappers.

A GuardedJoin wrapper does not automatically call RawStorage::get_mut, so it can be useful to avoid flagging modifications with a FlaggedStorage.

impl<S: DenseStorage> MaskedStorage<S>[src]

pub fn as_slice(&self) -> &[S::Item][src]

pub fn as_mut_slice(&mut self) -> &mut [S::Item][src]

impl<S: TrackedStorage> MaskedStorage<S>[src]

pub fn tracking_modified(&self) -> bool[src]

pub fn modified_indexes(&self) -> &ModifiedBitSet[src]

pub fn set_track_modified(&mut self, flag: bool)[src]

pub fn mark_modified(&self, index: Index)[src]

pub fn clear_modified(&mut self)[src]

pub fn modified(&self) -> ModifiedJoin<'_, S>[src]

Returns an IntoJoin type which joins over all the modified elements.

The items on the returned join are all Option<&S::Item>, removed elements will show up as None.

pub fn modified_mut(&mut self) -> ModifiedJoinMut<'_, S>[src]

Returns an IntoJoin type which joins over all the modified elements mutably.

This is similar to MaskedStorage::modified, but returns mutable access to each item.

Trait Implementations

impl<S: RawStorage + Default> Default for MaskedStorage<S>[src]

impl<S: RawStorage> Drop for MaskedStorage<S>[src]

impl<'a, S: RawStorage> Join for &'a MaskedStorage<S>[src]

type Item = &'a S::Item

type Access = &'a S

type Mask = &'a BitSet

impl<'a, S: RawStorage> Join for &'a mut MaskedStorage<S>[src]

type Item = &'a mut S::Item

type Access = &'a S

type Mask = &'a BitSet

Auto Trait Implementations

impl<S> RefUnwindSafe for MaskedStorage<S> where
    S: RefUnwindSafe

impl<S> Send for MaskedStorage<S> where
    S: Send

impl<S> Sync for MaskedStorage<S> where
    S: Sync

impl<S> Unpin for MaskedStorage<S> where
    S: Unpin

impl<S> UnwindSafe for MaskedStorage<S> where
    S: UnwindSafe

Blanket Implementations

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

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

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

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

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

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

impl<T> Pointable for T

type Init = T

The type for initializers.

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.