Struct shipyard::ViewMut[][src]

pub struct ViewMut<'a, T> { /* fields omitted */ }

Exclusive view over a component storage.

Implementations

impl<T> ViewMut<'_, T>[src]

pub fn inserted(&self) -> Inserted<&Self>[src]

Wraps this view to be able to iterate inserted components.

pub fn modified(&self) -> Modified<&Self>[src]

Wraps this view to be able to iterate modified components.

pub fn inserted_or_modified(&self) -> InsertedOrModified<&Self>[src]

Wraps this view to be able to iterate inserted and modified components.

pub fn inserted_mut(&mut self) -> Inserted<&mut Self>[src]

Wraps this view to be able to iterate inserted components.

pub fn modified_mut(&mut self) -> Modified<&mut Self>[src]

Wraps this view to be able to iterate modified components.

pub fn inserted_or_modified_mut(&mut self) -> InsertedOrModified<&mut Self>[src]

Wraps this view to be able to iterate inserted and modified components.

Methods from Deref<Target = SparseSet<T>>

pub fn as_slice(&self) -> &[T][src]

Returns a slice of all the components in this storage.

pub fn contains(&self, entity: EntityId) -> bool[src]

Returns true if entity owns a component in this storage.

pub fn len(&self) -> usize[src]

Returns the length of the storage.

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

Returns true if the storage’s length is 0.

pub fn index_of(&self, entity: EntityId) -> Option<usize>[src]

Returns the index of entity’s component in the dense and data vectors.
This index is only valid for this storage and until a modification happens.

pub unsafe fn index_of_unchecked(&self, entity: EntityId) -> usize[src]

Returns the index of entity’s component in the dense and data vectors.
This index is only valid for this storage and until a modification happens.

Safety

entity has to own a component of this type.
The index is only valid until a modification occurs in the storage.

pub fn id_at(&self, index: usize) -> Option<EntityId>[src]

Returns the EntityId at a given index.

pub fn remove(&mut self, entity: EntityId) -> Option<T> where
    T: 'static, 
[src]

Removes entity’s component from this storage.

pub fn delete(&mut self, entity: EntityId) -> bool where
    T: 'static, 
[src]

Deletes entity’s component from this storage.

pub fn is_inserted(&self, entity: EntityId) -> bool[src]

Returns true if entity’s component was inserted since the last clear_inserted or clear_all_inserted call.
Returns false if entity does not have a component in this storage.

pub fn is_modified(&self, entity: EntityId) -> bool[src]

Returns true if entity’s component was modified since the last clear_modified or clear_all_modified call.
Returns false if entity does not have a component in this storage.

pub fn is_inserted_or_modified(&self, entity: EntityId) -> bool[src]

Returns true if entity’s component was inserted or modified since the last clear call.
Returns false if entity does not have a component in this storage.

pub fn deleted(&self) -> &[(EntityId, T)][src]

Returns the deleted components of a storage tracking deletion.

Panics

pub fn removed(&self) -> &[EntityId][src]

Returns the ids of removed components of a storage tracking removal.

Panics

pub fn removed_or_deleted(&self) -> impl Iterator<Item = EntityId> + '_[src]

Returns the ids of removed or deleted components of a storage tracking removal and/or deletion.

Panics

pub fn take_deleted(&mut self) -> Vec<(EntityId, T)>[src]

Takes ownership of the deleted components of a storage tracking deletion.

Panics

pub fn take_removed(&mut self) -> Vec<EntityId>[src]

Takes ownership of the ids of removed components of a storage tracking removal.

Panics

pub fn take_removed_and_deleted(
    &mut self
) -> (Vec<EntityId>, Vec<(EntityId, T)>)
[src]

Takes ownership of the removed and deleted components of a storage tracking removal and/or deletion.

Panics

pub fn clear_inserted(&mut self, entity: EntityId)[src]

Removes the inserted flag on entity’s component.

Panics

pub fn clear_all_inserted(&mut self)[src]

Removes the inserted flag on all components of this storage.

Panics

pub fn clear_modified(&mut self, entity: EntityId)[src]

Removes the modified flag on entity’s component.

Panics

pub fn clear_all_modified(&mut self)[src]

Removes the modified flag on all components of this storage.

Panics

pub fn clear_inserted_and_modified(&mut self, entity: EntityId)[src]

Removes the inserted and modified flags on entity’s component.

Panics

pub fn clear_all_inserted_and_modified(&mut self)[src]

Removes the inserted and modified flags on all components of this storage.

Panics

pub fn track_insertion(&mut self) -> &mut Self[src]

Flags components when they are inserted.
To check the flag use is_inserted, is_inserted_or_modified or iterate over the storage after calling inserted.
To clear the flag use clear_inserted or clear_all_inserted.

pub fn track_modification(&mut self) -> &mut Self[src]

Flags components when they are modified. Will not flag components already flagged inserted.
To check the flag use is_modified, is_inserted_or_modified or iterate over the storage after calling modified.
To clear the flag use clear_modified or clear_all_modified.

pub fn track_deletion(&mut self) -> &mut Self[src]

Stores components and their EntityId when they are deleted.
You can access them with deleted or removed_or_deleted.
You can clear them and get back a Vec with take_deleted or take_removed_and_deleted.

pub fn track_removal(&mut self) -> &mut Self[src]

Stores EntityId of deleted components.
You can access them with removed or removed_or_deleted.
You can clear them and get back a Vec with take_removed or take_removed_and_deleted.

pub fn track_all(&mut self)[src]

Flags component insertion, modification, deletion and removal.
Same as calling track_insertion, track_modification, track_deletion and track_removal.

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

Returns true if the storage tracks insertion.

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

Returns true if the storage tracks modification.

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

Returns true if the storage tracks deletion.

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

Returns true if the storage tracks removal.

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

Returns true if the storage tracks insertion, modification, deletion or removal.

pub fn reserve(&mut self, additional: usize)[src]

Reserves memory for at least additional components. Adding components can still allocate though.

pub fn clear(&mut self)[src]

Deletes all components in this storage.

pub fn apply<R, F: FnOnce(&mut T, &T) -> R>(
    &mut self,
    a: EntityId,
    b: EntityId,
    f: F
) -> R
[src]

Applies the given function f to the entities a and b.
The two entities shouldn’t point to the same component.

Panics

  • MissingComponent - if one of the entity doesn’t have any component in the storage.
  • IdenticalIds - if the two entities point to the same component.

pub fn apply_mut<R, F: FnOnce(&mut T, &mut T) -> R>(
    &mut self,
    a: EntityId,
    b: EntityId,
    f: F
) -> R
[src]

Applies the given function f to the entities a and b.
The two entities shouldn’t point to the same component.

Panics

  • MissingComponent - if one of the entity doesn’t have any component in the storage.
  • IdenticalIds - if the two entities point to the same component.

pub fn drain(&mut self) -> SparseSetDrain<'_, T>

Notable traits for SparseSetDrain<'a, T>

impl<'a, T> Iterator for SparseSetDrain<'a, T> type Item = T;
[src]

Creates a draining iterator that empties the storage and yields the removed items.

pub fn sort_unstable_by<F: FnMut(&T, &T) -> Ordering>(&mut self, compare: F)[src]

Sorts the SparseSet with a comparator function, but may not preserve the order of equal elements.

pub fn sort_unstable(&mut self)[src]

Sorts the SparseSet, but may not preserve the order of equal elements.

Trait Implementations

impl<T: 'static> AddComponent for ViewMut<'_, T>[src]

type Component = T

impl<T: 'static> AddComponent for &mut ViewMut<'_, T>[src]

type Component = T

impl<T: 'static> AddEntity for ViewMut<'_, T>[src]

type Component = T

impl<T: 'static> AddEntity for &mut ViewMut<'_, T>[src]

type Component = T

impl<'a, T> AsMut<SparseSet<T>> for ViewMut<'a, T>[src]

impl<'a, T> AsMut<ViewMut<'a, T>> for ViewMut<'a, T>[src]

impl<'a, T> AsRef<SparseSet<T>> for ViewMut<'a, T>[src]

impl<'a, T: 'static + Send + Sync> BorrowInfo for ViewMut<'a, T>[src]

impl<T> BulkReserve for ViewMut<'_, T>[src]

impl<T> BulkReserve for &mut ViewMut<'_, T>[src]

impl<'a: 'b, 'b, T: 'static> Contains for &'b ViewMut<'a, T>[src]

impl<'a: 'b, 'b, T: 'static> Contains for &'b mut ViewMut<'a, T>[src]

impl<T: 'static> Delete for ViewMut<'_, T>[src]

impl<T: 'static> Delete for &mut ViewMut<'_, T>[src]

impl<T> Deref for ViewMut<'_, T>[src]

type Target = SparseSet<T>

The resulting type after dereferencing.

impl<T> DerefMut for ViewMut<'_, T>[src]

impl<'a: 'b, 'b, T: 'static> Get for &'b ViewMut<'a, T>[src]

type Out = &'b T

type FastOut = &'b T

impl<'a: 'b, 'b, T: 'static> Get for &'b mut ViewMut<'a, T>[src]

type Out = Mut<'b, T>

type FastOut = &'b mut T

impl<T: 'static + Send + Sync> IntoBorrow for ViewMut<'_, T>[src]

type Borrow = ViewMutBorrower<T>

Helper type almost allowing GAT on stable.

impl<T> Not for &ViewMut<'_, T>[src]

type Output = Not<Self>

The resulting type after applying the ! operator.

impl<T> Not for &mut ViewMut<'_, T>[src]

type Output = Not<Self>

The resulting type after applying the ! operator.

impl<T: 'static> Remove for ViewMut<'_, T>[src]

type Out = Option<T>

Type of the removed component.

impl<T: 'static> Remove for &mut ViewMut<'_, T>[src]

type Out = Option<T>

Type of the removed component.

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for ViewMut<'a, T> where
    T: RefUnwindSafe

impl<'a, T> Send for ViewMut<'a, T> where
    T: Send

impl<'a, T> Sync for ViewMut<'a, T> where
    T: Sync

impl<'a, T> Unpin for ViewMut<'a, T>

impl<'a, T> !UnwindSafe for ViewMut<'a, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[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.