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

Exclusive view over a component storage.

Implementations

Creates a new ViewMut for custom SparseSet storage.

use shipyard::{track, Component, SparseSet, StorageId, 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();

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.

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.

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.

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.

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 clear call.
Returns false if entity does not have a component in this storage.

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.

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.

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.

Deletes all components in this storage.

Wraps this view to be able to iterate inserted components.

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

Wraps this view to be able to iterate inserted components.

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

Removes the inserted flag on all components of this storage.

Wraps this view to be able to iterate modified components.

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

Wraps this view to be able to iterate modified components.

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

Removes the modified flag on all components of this storage.

Returns the deleted components of a storage tracking deletion.

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

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

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

Wraps this view to be able to iterate inserted components.

Wraps this view to be able to iterate modified components.

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

Wraps this view to be able to iterate inserted components.

Wraps this view to be able to iterate modified components.

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

Removes the inserted flag on all components of this storage.

Removes the modified flag on all components of this storage.

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

Returns the deleted components of a storage tracking deletion.

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

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

Methods from Deref<Target = SparseSet<T>>

Returns a slice of all the components in this storage.

Returns true if entity owns a component in this storage.

Returns the length of the storage.

Returns true if the storage’s length is 0.

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.

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.

Returns the EntityId at a given index.

Clear all deletion tracking data.

Clear all deletion tracking data older than some timestamp.

Clear all deletion and removal tracking data.

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

Clear all removal tracking data.

Clear all removal tracking data older than some timestamp.

Clear all deletion and removal tracking data.

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

Clear all deletion tracking data.

Clear all deletion tracking data older than some timestamp.

Clear all removal tracking data.

Clear all removal tracking data older than some timestamp.

Clear all deletion and removal tracking data.

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

Returns true if the storage tracks insertion.

Returns true if the storage tracks modification.

Returns true if the storage tracks deletion.

Returns true if the storage tracks removal.

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

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

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

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

Trait Implementations

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

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

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

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

Adds a new entity with component.

Adds a new entity with component.

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

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

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

The resulting type after applying the | operator.

Performs the | operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

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

Reserves memory for all entities in new_entities.

Reserves memory for all entities in new_entities.

Returns true if all storages contains entity.

Returns true if all storages contains entity.

Formats the value using the given formatter. Read more

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

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

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Retrieve components of entity. Read more

Retrieve components of entity. Read more

Retrieve components of entity. Read more

Retrieve components of entity. Read more

Retrieve components of entity. Read more

Retrieve components of entity. Read more

Retrieve components of entity. Read more

The returned type after indexing.

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

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

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

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

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

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

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

Helper type almost allowing GAT on stable.

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

Type of the removed component.

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

Type of the removed component.

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

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

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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