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

Shared view over a component storage.

Implementations

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.

Creates a new View for custom SparseSet storage.

use shipyard::{track, Component, SparseSet, StorageId, View, 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 =
    View::<ScriptingComponent>::new_for_custom_storage(StorageId::Custom(0), all_storages)
        .unwrap();

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 modified components.

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

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.

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.

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.

Trait Implementations

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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns true if all storages contains entity.

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Retrieve components of entity. Read more

The returned type after indexing.

Performs the 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

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. 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