pub trait View<'a>:
Sized
+ Send
+ Sync
+ 'static {
type Iter: Iterator + 'a;
// Required methods
fn fetch(
archetype: &'a ArchetypeData,
chunk: &'a ComponentStorage,
chunk_index: ChunkIndex,
set_index: SetIndex,
) -> Self::Iter;
fn validate() -> bool;
fn validate_access(access: &ComponentAccess<'_>) -> bool;
fn reads<T: Component>() -> bool;
fn writes<T: Component>() -> bool;
fn requires_permissions() -> Permissions<ComponentTypeId>;
}Expand description
A type which can fetch a strongly-typed view of the data contained within a chunk.
Required Associated Types§
Required Methods§
Sourcefn fetch(
archetype: &'a ArchetypeData,
chunk: &'a ComponentStorage,
chunk_index: ChunkIndex,
set_index: SetIndex,
) -> Self::Iter
fn fetch( archetype: &'a ArchetypeData, chunk: &'a ComponentStorage, chunk_index: ChunkIndex, set_index: SetIndex, ) -> Self::Iter
Pulls data out of a chunk.
Sourcefn validate_access(access: &ComponentAccess<'_>) -> bool
fn validate_access(access: &ComponentAccess<'_>) -> bool
Determines if the given component access includes all permissions required by the view.
Sourcefn requires_permissions() -> Permissions<ComponentTypeId>
fn requires_permissions() -> Permissions<ComponentTypeId>
Returns the set of permissions required by the view.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.