ViewMut

Struct ViewMut 

Source
pub struct ViewMut<'a, T: Component, Track = <T as Component>::Tracking> { /* private fields */ }
Expand description

Exclusive view over a component storage.

Implementations§

Source§

impl<'v, T: Component, Track> ViewMut<'v, T, Track>

Source

pub fn as_optional(&mut self) -> Optional<&mut ViewMut<'v, T, Track>>

Source§

impl<'a, T: Component, Track> ViewMut<'a, T, Track>
where Track: Tracking,

Source

pub fn as_view(&self) -> View<'_, T, Track>

Returns a View reborrowing from ViewMut.

There are often alternatives to calling this method, like reborrow.
One case where this method shines is for calling a system in another system.
sys_b cannot use a reference or it wouldn’t work as a system anymore.


fn sys_a(vm_compA: ViewMut<A>) {
    // -- SNIP --

    sys_b(vm_compA.as_view());
}

fn sys_b(v_compA: View<A>) {}

world.run(sys_a);
world.run(sys_b);
Source

pub fn override_last_insertion( &mut self, new_timestamp: TrackingTimestamp, ) -> TrackingTimestamp

Replaces the timestamp starting the tracking time window for insertions.

Tracking works based on a time window. From the last time the system ran (in workloads) or since the last clear.

Sometimes this automatic time window isn’t what you need. This can happen when you want to keep the same tracking information for multiple runs of the same system.

For example if you interpolate movement between frames, you might run an interpolation workload multiple times but not change the World during its execution.
In this case you want the same tracking information for all runs of this workload which would have disappeared using the automatic window.

Source

pub fn override_last_modification( &mut self, new_timestamp: TrackingTimestamp, ) -> TrackingTimestamp

Replaces the timestamp starting the tracking time window for modifications.

Tracking works based on a time window. From the last time the system ran (in workloads) or since the last clear.

Sometimes this automatic time window isn’t what you need. This can happen when you want to keep the same tracking information for multiple runs of the same system.

For example if you interpolate movement between frames, you might run an interpolation workload multiple times but not change the World during its execution.
In this case you want the same tracking information for all runs of this workload which would have disappeared using the automatic window.

Source

pub fn override_last_removal_or_deletion( &mut self, new_timestamp: TrackingTimestamp, ) -> TrackingTimestamp

Replaces the timestamp starting the tracking time window for removals and deletions.

Tracking works based on a time window. From the last time the system ran (in workloads) or since the last clear.

Sometimes this automatic time window isn’t what you need. This can happen when you want to keep the same tracking information for multiple runs of the same system.

For example if you interpolate movement between frames, you might run an interpolation workload multiple times but not change the World during its execution.
In this case you want the same tracking information for all runs of this workload which would have disappeared using the automatic window.

Source§

impl<'a, T: Component> ViewMut<'a, T, Untracked>

Source

pub fn new_for_custom_storage( storage_id: StorageId, all_storages: ARef<'a, &'a AllStorages>, ) -> Result<Self, CustomStorageView>

Creates a new ViewMut for custom SparseSet storage.

use shipyard::{track, advanced::StorageId, Component, sparse_set::SparseSet, ViewMut, World};

struct ScriptingComponent(Vec<u8>);
impl Component for ScriptingComponent {
    type Tracking = track::Untracked;
}

let world = World::new();

world.add_custom_storage(
    StorageId::Custom(0),
    SparseSet::<ScriptingComponent>::new_custom_storage(),
).unwrap();

let all_storages = world.all_storages().unwrap();
let scripting_storage =
    ViewMut::<ScriptingComponent>::new_for_custom_storage(StorageId::Custom(0), all_storages)
        .unwrap();
Source§

impl<'a, T: Component, Track> ViewMut<'a, T, Track>
where Track: Tracking,

Source

pub fn clear(&mut self)

Deletes all components in this storage.

Source

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

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

Source

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

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.
Source

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

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.
Source

pub fn retain<F: FnMut(EntityId, &T) -> bool>(&mut self, f: F)

Deletes all components for which f(id, &component) returns false.

Source

pub fn retain_mut<F: FnMut(EntityId, Mut<'_, T>) -> bool>(&mut self, f: F)

Deletes all components for which f(id, Mut<component>) returns false.

Source§

impl<'v, Track, T: Component + Default> ViewMut<'v, T, Track>
where for<'a> &'a mut ViewMut<'v, T, Track>: Get,

Source

pub fn get_or_default<'a>( &'a mut self, entity: EntityId, ) -> Option<<&'a mut ViewMut<'v, T, Track> as Get>::Out>

Retrieve entity component.

If the entity doesn’t have the component, insert its Default value.

§Errors

Returns None when entity is dead and a component is already present for an entity with the same index.

Source§

impl<'v, Track, T: Component> ViewMut<'v, T, Track>
where for<'a> &'a mut ViewMut<'v, T, Track>: Get,

Source

pub fn get_or_insert<'a>( &'a mut self, entity: EntityId, component: T, ) -> Option<<&'a mut ViewMut<'v, T, Track> as Get>::Out>

Retrieve entity component.

If the entity doesn’t have the component, insert component.

§Errors

Returns None when entity is dead and a component is already present for an entity with the same index.

Source

pub fn get_or_insert_with<'a, F: FnOnce() -> T>( &'a mut self, entity: EntityId, f: F, ) -> Option<<&'a mut ViewMut<'v, T, Track> as Get>::Out>

Retrieve entity component.

If the entity doesn’t have the component, insert the result of f.

§Errors

Returns None when entity is dead and a component is already present for an entity with the same index.

Source§

impl<Track, T: Component> ViewMut<'_, T, Track>
where Track: InsertionTracking,

Source

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

Inside a workload returns true if entity’s component was inserted since the last run of this system.
Outside workloads returns true if entity’s component was inserted since the last call to clear_all_inserted.
Returns false if entity does not have a component in this storage.

Source

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

Wraps this view to be able to iterate inserted components.

Source

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

Wraps this view to be able to iterate inserted components.

Source

pub fn clear_all_inserted(self)

Removes the inserted flag on all components of this storage.

Source§

impl<Track, T: Component> ViewMut<'_, T, Track>
where Track: ModificationTracking,

Source

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

Inside a workload returns true if entity’s component was modified since the last run of this system.
Outside workloads returns true if entity’s component was modified since the last call to clear_all_modified.
Returns false if entity does not have a component in this storage.

Source

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

Wraps this view to be able to iterate modified components.

Source

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

Wraps this view to be able to iterate modified components.

Source

pub fn clear_all_modified(self)

Removes the modified flag on all components of this storage.

Source§

impl<Track, T: Component> ViewMut<'_, T, Track>

Source

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

Inside a workload returns true if entity’s component was inserted or modified since the last run of this system.
Outside workloads returns true if entity’s component was inserted or modified since the last call to clear_all_inserted.
Returns false if entity does not have a component in this storage.

Source

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

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

Source

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

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

Source

pub fn clear_all_inserted_and_modified(self)

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

Source§

impl<Track, T: Component> ViewMut<'_, T, Track>
where Track: DeletionTracking,

Source

pub fn is_deleted(&self, entity: EntityId) -> bool

Inside a workload returns true if entity’s component was deleted since the last run of this system.
Outside workloads returns true if entity’s component was deleted since the last call to clear_all_deleted.
Returns false if entity does not have a component in this storage.

Source

pub fn deleted(&self) -> impl Iterator<Item = (EntityId, &T)> + '_

Returns the deleted components of a storage tracking deletion.

Source§

impl<Track, T: Component> ViewMut<'_, T, Track>
where Track: RemovalTracking,

Source

pub fn is_removed(&self, entity: EntityId) -> bool

Inside a workload returns true if entity’s component was removed since the last run of this system.
Outside workloads returns true if entity’s component was removed since the last call to clear_all_removed.
Returns false if entity does not have a component in this storage.

Source

pub fn removed(&self) -> impl Iterator<Item = EntityId> + '_

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

Source§

impl<Track, T: Component> ViewMut<'_, T, Track>

Source

pub fn is_removed_or_deleted(&self, entity: EntityId) -> bool

Inside a workload returns true if entity’s component was deleted or removed since the last run of this system.
Outside workloads returns true if entity’s component was deleted or removed since the last clear call.
Returns false if entity does not have a component in this storage.

Source

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

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

Methods from Deref<Target = SparseSet<T>>§

Source

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

Returns a slice of all the components in this storage.

Source

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

Returns true if entity owns a component in this storage.

Source

pub fn len(&self) -> usize

Returns the length of the storage.

Source

pub fn is_empty(&self) -> bool

Returns true if the storage’s length is 0.

Source

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

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.

Source

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

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.

Source

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

Returns the EntityId at a given index.

Source

pub fn on_insertion( &mut self, f: impl FnMut(EntityId, &T) + Send + Sync + 'static, )

Sets the on insertion callback.

Source

pub fn take_on_insertion( &mut self, ) -> Option<Box<dyn FnMut(EntityId, &T) + Send + Sync + 'static>>

Remove the on insertion callback.

Source

pub fn on_removal( &mut self, f: impl FnMut(EntityId, &T) + Send + Sync + 'static, )

Sets the on removal and deletion callback.

Source

pub fn take_on_removal( &mut self, ) -> Option<Box<dyn FnMut(EntityId, &T) + Send + Sync + 'static>>

Remove the on removal and deletion callback.

Source

pub fn insert( &mut self, entity: EntityId, value: T, current: TrackingTimestamp, ) -> InsertionResult<T>

Inserts value in the SparseSet.

§Tracking

In case entity had a component of this type, the new component will be considered modified.
In all other cases it’ll be considered inserted.

Source

pub fn clear_all_deleted(&mut self)

Clear all deletion tracking data.

Source

pub fn clear_all_deleted_older_than_timestamp( &mut self, timestamp: TrackingTimestamp, )

Clear all deletion tracking data older than some timestamp.

Source

pub fn clear_all_removed(&mut self)

Clear all removal tracking data.

Source

pub fn clear_all_removed_older_than_timestamp( &mut self, timestamp: TrackingTimestamp, )

Clear all removal tracking data older than some timestamp.

Source

pub fn clear_all_removed_and_deleted(&mut self)

Clear all deletion and removal tracking data.

Source

pub fn clear_all_removed_and_deleted_older_than_timestamp( &mut self, timestamp: TrackingTimestamp, )

Clear all deletion and removal tracking data older than some timestamp.

Source

pub fn track_insertion(&mut self) -> &mut SparseSet<T>

Make this storage track insertions.

Source

pub fn track_modification(&mut self) -> &mut SparseSet<T>

Make this storage track modification.

Source

pub fn track_deletion(&mut self) -> &mut SparseSet<T>

Make this storage track deletions.

Source

pub fn track_removal(&mut self) -> &mut SparseSet<T>

Make this storage track removals.

Source

pub fn track_all(&mut self)

Make this storage track insertions, modifications, deletions and removals.

Source

pub fn is_tracking_insertion(&self) -> bool

Returns true if the storage tracks insertion.

Source

pub fn is_tracking_modification(&self) -> bool

Returns true if the storage tracks modification.

Source

pub fn is_tracking_deletion(&self) -> bool

Returns true if the storage tracks deletion.

Source

pub fn is_tracking_removal(&self) -> bool

Returns true if the storage tracks removal.

Source

pub fn is_tracking_any(&self) -> bool

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

Source

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

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

Source

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

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

Source

pub fn sort_unstable(&mut self)

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

Source

pub fn register_clone(&mut self)

Registers the function to clone this component.

Trait Implementations§

Source§

impl<T: Component, TRACK> AddComponent<Option<T>> for &mut ViewMut<'_, T, TRACK>

Source§

fn add_component_unchecked(&mut self, entity: EntityId, component: Option<T>)

Adds component to entity, multiple components can be added at the same time using a tuple.
This function does not check entity is alive. It’s possible to add components to removed entities.
Use Entities::add_component if you’re unsure. Read more
Source§

impl<T: Component, TRACK> AddComponent<Option<T>> for ViewMut<'_, T, TRACK>

Source§

fn add_component_unchecked(&mut self, entity: EntityId, component: Option<T>)

Adds component to entity, multiple components can be added at the same time using a tuple.
This function does not check entity is alive. It’s possible to add components to removed entities.
Use Entities::add_component if you’re unsure. Read more
Source§

impl<T: Component, TRACK> AddComponent<T> for &mut ViewMut<'_, T, TRACK>

Source§

fn add_component_unchecked(&mut self, entity: EntityId, component: T)

Adds component to entity, multiple components can be added at the same time using a tuple.
This function does not check entity is alive. It’s possible to add components to removed entities.
Use Entities::add_component if you’re unsure. Read more
Source§

impl<T: Component, TRACK> AddComponent<T> for ViewMut<'_, T, TRACK>

Source§

fn add_component_unchecked(&mut self, entity: EntityId, component: T)

Adds component to entity, multiple components can be added at the same time using a tuple.
This function does not check entity is alive. It’s possible to add components to removed entities.
Use Entities::add_component if you’re unsure. Read more
Source§

impl<T: Component + PartialEq> AddDistinctComponent for &mut ViewMut<'_, T>

Source§

type Component = T

Source§

fn add_distinct_component_unchecked( &mut self, entity: EntityId, component: Self::Component, ) -> bool

Adds component to entity, multiple components can be added at the same time using a tuple.
If the entity already has this component, it won’t be replaced. Very useful if you want accurate modification tracking.
This function does not check entity is alive. It’s possible to add components to removed entities.
Use Entities::add_component if you’re unsure. Read more
Source§

impl<T: Component + PartialEq> AddDistinctComponent for ViewMut<'_, T>

Source§

type Component = T

Source§

fn add_distinct_component_unchecked( &mut self, entity: EntityId, component: Self::Component, ) -> bool

Adds component to entity, multiple components can be added at the same time using a tuple.
If the entity already has this component, it won’t be replaced. Very useful if you want accurate modification tracking.
This function does not check entity is alive. It’s possible to add components to removed entities.
Use Entities::add_component if you’re unsure. Read more
Source§

impl<T: Component, TRACK> AddEntity for &mut ViewMut<'_, T, TRACK>

Source§

type Component = T

Source§

fn add_entity(storage: &mut Self, entity: EntityId, component: Self::Component)

Adds a new entity with component.
Source§

impl<T: Component, TRACK> AddEntity for ViewMut<'_, T, TRACK>

Source§

type Component = T

Source§

fn add_entity(storage: &mut Self, entity: EntityId, component: Self::Component)

Adds a new entity with component.
Source§

impl<'a, T: Component, Track> AsMut<SparseSet<T>> for ViewMut<'a, T, Track>

Source§

fn as_mut(&mut self) -> &mut SparseSet<T>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<'a, T: Component, Track> AsMut<ViewMut<'a, T, Track>> for ViewMut<'a, T, Track>

Source§

fn as_mut(&mut self) -> &mut Self

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<'a, T: Component, Track> AsRef<SparseSet<T>> for ViewMut<'a, T, Track>

Source§

fn as_ref(&self) -> &SparseSet<T>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a, T: Component, Track: Tracking, U> BitOr<U> for &'a ViewMut<'a, T, Track>

Source§

type Output = Or<(&'a ViewMut<'a, T, Track>, U)>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: U) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a, T: Component, Track: Tracking, U> BitOr<U> for &'a mut ViewMut<'a, T, Track>

Source§

type Output = Or<(&'a mut ViewMut<'a, T, Track>, U)>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: U) -> Self::Output

Performs the | operation. Read more
Source§

impl<T: Send + Sync + Component, Track> Borrow for ViewMut<'_, T, Track>
where Track: Tracking,

Source§

type View<'a> = ViewMut<'a, T, Track>

Source§

fn borrow<'a>( all_storages: &'a AllStorages, all_borrow: Option<SharedBorrow<'a>>, last_run: Option<TrackingTimestamp>, current: TrackingTimestamp, ) -> Result<Self::View<'a>, GetStorage>

This function is where the actual borrowing happens.
Source§

impl<'a, T: Send + Sync + Component, Track> BorrowInfo for ViewMut<'a, T, Track>
where Track: Tracking,

Source§

fn borrow_info(info: &mut Vec<TypeInfo>)

This information is used during workload creation to determine which systems can run in parallel. Read more
Source§

fn enable_tracking( enable_tracking_fn: &mut Vec<fn(&AllStorages) -> Result<(), GetStorage>>, )

Enable tracking on the World where this storage is borrowed.
Source§

impl<T: Component, TRACK> BulkReserve for &mut ViewMut<'_, T, TRACK>

Source§

fn bulk_reserve(&mut self, new_entities: &[EntityId])

Reserves memory for all entities in new_entities.
Source§

impl<T: Component, TRACK> BulkReserve for ViewMut<'_, T, TRACK>

Source§

fn bulk_reserve(&mut self, new_entities: &[EntityId])

Reserves memory for all entities in new_entities.
Source§

impl<'a: 'b, 'b, T: Component, Track: Tracking> Contains for &'b ViewMut<'a, T, Track>

Source§

fn contains(&self, entity: EntityId) -> bool

Returns true if all storages contains entity.
Source§

impl<'a: 'b, 'b, T: Component, Track: Tracking> Contains for &'b mut ViewMut<'a, T, Track>

Source§

fn contains(&self, entity: EntityId) -> bool

Returns true if all storages contains entity.
Source§

impl<T: Debug + Component, Track> Debug for ViewMut<'_, T, Track>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Component, TRACK> Delete for &mut ViewMut<'_, T, TRACK>

Source§

fn delete(&mut self, entity: EntityId) -> bool

Deletes component in entity, return true if the entity had this component.
Multiple components can be deleted at the same time using a tuple. Read more
Source§

impl<T: Component, TRACK> Delete for ViewMut<'_, T, TRACK>

Source§

fn delete(&mut self, entity: EntityId) -> bool

Deletes component in entity, return true if the entity had this component.
Multiple components can be deleted at the same time using a tuple. Read more
Source§

impl<T: Component, Track> Deref for ViewMut<'_, T, Track>

Source§

type Target = SparseSet<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: Component, Track> DerefMut for ViewMut<'_, T, Track>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'view, 'de: 'view, T, Track: Tracking> Deserialize<'de> for ViewMut<'view, T, Track>

Available on crate feature serde1 only.
Source§

fn deserialize<D>(_deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a, 'b, T: Component, Track: Tracking> Get for &'b ViewMut<'a, T, Track>

Source§

type Out = &'b T

Source§

fn get(self, entity: EntityId) -> Result<Self::Out, MissingComponent>

Retrieve components of entity. Read more
Source§

impl<'a, 'b, T: Component, Track: Tracking> Get for &'b mut ViewMut<'a, T, Track>

Source§

type Out = Mut<'b, T>

Source§

fn get(self, entity: EntityId) -> Result<Self::Out, MissingComponent>

Retrieve components of entity. Read more
Source§

impl<'a, T: Component, Track> Index<EntityId> for ViewMut<'a, T, Track>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, entity: EntityId) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, T: Component, Track> IndexMut<EntityId> for ViewMut<'a, T, Track>

Source§

fn index_mut(&mut self, entity: EntityId) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'tmp, 'v: 'tmp, T: Component, Track: Tracking> IntoShiperator for &'tmp ViewMut<'v, T, Track>

Source§

type Shiperator = FullRawWindow<'tmp, T>

Source§

fn into_shiperator( self, _storage_ids: &mut ShipHashSet<StorageId>, ) -> (Self::Shiperator, usize, RawEntityIdAccess)

Returns the Shiperator, its maximum length and RawEntityIdAccess.
Source§

fn can_captain() -> bool

Returns true if the Shiperator can be a captain.
Source§

fn can_sailor() -> bool

Returns true if the Shiperator can be a sailor.
Source§

impl<'tmp, 'v: 'tmp, T: Component, Track> IntoShiperator for &'tmp mut ViewMut<'v, T, Track>

Source§

type Shiperator = FullRawWindowMut<'tmp, T, Track>

Source§

fn into_shiperator( self, _storage_ids: &mut ShipHashSet<StorageId>, ) -> (Self::Shiperator, usize, RawEntityIdAccess)

Returns the Shiperator, its maximum length and RawEntityIdAccess.
Source§

fn can_captain() -> bool

Returns true if the Shiperator can be a captain.
Source§

fn can_sailor() -> bool

Returns true if the Shiperator can be a sailor.
Source§

impl<T: Component, Track: Tracking> Not for &ViewMut<'_, T, Track>

Source§

type Output = Not<&ViewMut<'_, T, Track>>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<T: Component, Track: Tracking> Not for &mut ViewMut<'_, T, Track>

Source§

type Output = Not<&mut ViewMut<'_, T, Track>>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<T: Component, TRACK> Remove for &mut ViewMut<'_, T, TRACK>

Source§

type Out = Option<T>

Type of the removed component.
Source§

fn remove(&mut self, entity: EntityId) -> Self::Out

Removes component in entity, if the entity had a component, they will be returned.
Multiple components can be removed at the same time using a tuple. Read more
Source§

impl<T: Component, TRACK> Remove for ViewMut<'_, T, TRACK>

Source§

type Out = Option<T>

Type of the removed component.
Source§

fn remove(&mut self, entity: EntityId) -> Self::Out

Removes component in entity, if the entity had a component, they will be returned.
Multiple components can be removed at the same time using a tuple. Read more
Source§

impl<'view, T: Component + Serialize, Track: Tracking> Serialize for ViewMut<'view, T, Track>

Available on crate feature serde1 only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<'a, T, Track> Freeze for ViewMut<'a, T, Track>

§

impl<'a, T, Track = <T as Component>::Tracking> !RefUnwindSafe for ViewMut<'a, T, Track>

§

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

§

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

§

impl<'a, T, Track> Unpin for ViewMut<'a, T, Track>
where Track: Unpin,

§

impl<'a, T, Track = <T as Component>::Tracking> !UnwindSafe for ViewMut<'a, T, Track>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WorldBorrow for T
where T: Borrow,

Source§

type WorldView<'a> = <T as Borrow>::View<'a>

Source§

fn world_borrow( world: &World, last_run: Option<TrackingTimestamp>, current: TrackingTimestamp, ) -> Result<<T as WorldBorrow>::WorldView<'_>, GetStorage>

This function is where the actual borrowing happens.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,