[−][src]Struct goggles::masked::MaskedStorage
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]
&mut self,
index: Index,
f: impl FnOnce() -> S::Item
) -> &mut S::Item
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]
S::Item: PartialEq,
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]
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
fn open(self) -> (Self::Mask, Self::Access)
[src]
unsafe fn get(access: &Self::Access, index: Index) -> Self::Item
[src]
impl<'a, S: RawStorage> Join for &'a mut MaskedStorage<S>
[src]
Auto Trait Implementations
impl<S> RefUnwindSafe for MaskedStorage<S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for MaskedStorage<S> where
S: Send,
S: Send,
impl<S> Sync for MaskedStorage<S> where
S: Sync,
S: Sync,
impl<S> Unpin for MaskedStorage<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for MaskedStorage<S> where
S: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
[src]
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,