Trait legion::query::View[][src]

pub trait View<'data>: DefaultFilter + Sized {
    type Element: Send + Sync + 'data;
    type Fetch: Fetch + IntoIndexableIter<Item = Self::Element> + 'data;
    type Iter: Iterator<Item = Option<Self::Fetch>> + 'data;
    type Read: AsRef<[ComponentTypeId]>;
    type Write: AsRef<[ComponentTypeId]>;
    unsafe fn fetch(
        components: &'data Components,
        archetypes: &'data [Archetype],
        query: QueryResult<'data>
    ) -> Self::Iter;
fn validate();
fn validate_access(access: &ComponentAccess<'_>) -> bool;
fn reads_types() -> Self::Read;
fn writes_types() -> Self::Write;
fn reads<T: Component>() -> bool;
fn writes<T: Component>() -> bool;
fn requires_permissions() -> Permissions<ComponentTypeId>; }

A type which can pull entity data out of a world.

Associated Types

type Element: Send + Sync + 'data[src]

The type of component references returned.

type Fetch: Fetch + IntoIndexableIter<Item = Self::Element> + 'data[src]

The fetch type yielded for each archetype.

type Iter: Iterator<Item = Option<Self::Fetch>> + 'data[src]

The iterator type which pulls entity data out of a world.

type Read: AsRef<[ComponentTypeId]>[src]

Contains the type IDs read by the view.

type Write: AsRef<[ComponentTypeId]>[src]

Contains the type IDs written by the view.

Loading content...

Required methods

unsafe fn fetch(
    components: &'data Components,
    archetypes: &'data [Archetype],
    query: QueryResult<'data>
) -> Self::Iter
[src]

Creates an iterator which will yield slices of entity data for each archetype.

Safety

This method may return mutable references to entity data via shared world references. The caller must ensure that no two view iterators are alive at the same time which access any components in a manner which may cause mutable aliasing.

fn validate()[src]

Determines if this view type is valid. Panics if checks fail.

fn validate_access(access: &ComponentAccess<'_>) -> bool[src]

Returns true if the given component access includes all permissions required by the view.

fn reads_types() -> Self::Read[src]

Returns the component types read by the view.

fn writes_types() -> Self::Write[src]

Returns the component types written to by the view.

fn reads<T: Component>() -> bool[src]

Returns true if the view reads the specified data type.

fn writes<T: Component>() -> bool[src]

Returns true if the view writes to the specified data type.

fn requires_permissions() -> Permissions<ComponentTypeId>[src]

Returns a permissions struct declaring the component accesses required by the view.

Loading content...

Implementations on Foreign Types

impl<'a, A: View<'a> + 'a, B: View<'a> + 'a, C: View<'a> + 'a, D: View<'a> + 'a, E: View<'a> + 'a, F: View<'a> + 'a, G: View<'a> + 'a, H: View<'a> + 'a> View<'a> for (A, B, C, D, E, F, G, H)[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = MultiFetch<'a, (A::Fetch, B::Fetch, C::Fetch, D::Fetch, E::Fetch, F::Fetch, G::Fetch, H::Fetch)>

type Iter = MapInto<Zip<(A::Iter, B::Iter, C::Iter, D::Iter, E::Iter, F::Iter, G::Iter, H::Iter)>, Option<MultiFetch<'a, (A::Fetch, B::Fetch, C::Fetch, D::Fetch, E::Fetch, F::Fetch, G::Fetch, H::Fetch)>>>

type Read = Vec<ComponentTypeId>

type Write = Vec<ComponentTypeId>

impl<'a, B: View<'a> + 'a, C: View<'a> + 'a, D: View<'a> + 'a, E: View<'a> + 'a, F: View<'a> + 'a, G: View<'a> + 'a, H: View<'a> + 'a> View<'a> for (B, C, D, E, F, G, H)[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = MultiFetch<'a, (B::Fetch, C::Fetch, D::Fetch, E::Fetch, F::Fetch, G::Fetch, H::Fetch)>

type Iter = MapInto<Zip<(B::Iter, C::Iter, D::Iter, E::Iter, F::Iter, G::Iter, H::Iter)>, Option<MultiFetch<'a, (B::Fetch, C::Fetch, D::Fetch, E::Fetch, F::Fetch, G::Fetch, H::Fetch)>>>

type Read = Vec<ComponentTypeId>

type Write = Vec<ComponentTypeId>

impl<'a, C: View<'a> + 'a, D: View<'a> + 'a, E: View<'a> + 'a, F: View<'a> + 'a, G: View<'a> + 'a, H: View<'a> + 'a> View<'a> for (C, D, E, F, G, H)[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = MultiFetch<'a, (C::Fetch, D::Fetch, E::Fetch, F::Fetch, G::Fetch, H::Fetch)>

type Iter = MapInto<Zip<(C::Iter, D::Iter, E::Iter, F::Iter, G::Iter, H::Iter)>, Option<MultiFetch<'a, (C::Fetch, D::Fetch, E::Fetch, F::Fetch, G::Fetch, H::Fetch)>>>

type Read = Vec<ComponentTypeId>

type Write = Vec<ComponentTypeId>

impl<'a, D: View<'a> + 'a, E: View<'a> + 'a, F: View<'a> + 'a, G: View<'a> + 'a, H: View<'a> + 'a> View<'a> for (D, E, F, G, H)[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = MultiFetch<'a, (D::Fetch, E::Fetch, F::Fetch, G::Fetch, H::Fetch)>

type Iter = MapInto<Zip<(D::Iter, E::Iter, F::Iter, G::Iter, H::Iter)>, Option<MultiFetch<'a, (D::Fetch, E::Fetch, F::Fetch, G::Fetch, H::Fetch)>>>

type Read = Vec<ComponentTypeId>

type Write = Vec<ComponentTypeId>

impl<'a, E: View<'a> + 'a, F: View<'a> + 'a, G: View<'a> + 'a, H: View<'a> + 'a> View<'a> for (E, F, G, H)[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = MultiFetch<'a, (E::Fetch, F::Fetch, G::Fetch, H::Fetch)>

type Iter = MapInto<Zip<(E::Iter, F::Iter, G::Iter, H::Iter)>, Option<MultiFetch<'a, (E::Fetch, F::Fetch, G::Fetch, H::Fetch)>>>

type Read = Vec<ComponentTypeId>

type Write = Vec<ComponentTypeId>

impl<'a, F: View<'a> + 'a, G: View<'a> + 'a, H: View<'a> + 'a> View<'a> for (F, G, H)[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = MultiFetch<'a, (F::Fetch, G::Fetch, H::Fetch)>

type Iter = MapInto<Zip<(F::Iter, G::Iter, H::Iter)>, Option<MultiFetch<'a, (F::Fetch, G::Fetch, H::Fetch)>>>

type Read = Vec<ComponentTypeId>

type Write = Vec<ComponentTypeId>

impl<'a, G: View<'a> + 'a, H: View<'a> + 'a> View<'a> for (G, H)[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = MultiFetch<'a, (G::Fetch, H::Fetch)>

type Iter = MapInto<Zip<(G::Iter, H::Iter)>, Option<MultiFetch<'a, (G::Fetch, H::Fetch)>>>

type Read = Vec<ComponentTypeId>

type Write = Vec<ComponentTypeId>

impl<'a, H: View<'a> + 'a> View<'a> for (H,)[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = MultiFetch<'a, (H::Fetch,)>

type Iter = MapInto<Zip<(H::Iter,)>, Option<MultiFetch<'a, (H::Fetch,)>>>

type Read = Vec<ComponentTypeId>

type Write = Vec<ComponentTypeId>

Loading content...

Implementors

impl<'data> View<'data> for Entity[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = EntityFetch<'data>

type Iter = Iter<'data>

type Read = [ComponentTypeId; 0]

type Write = [ComponentTypeId; 0]

impl<'data, T: Component> View<'data> for Read<T>[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = ReadFetch<'data, T>

type Iter = ReadIter<'data, T>

type Read = [ComponentTypeId; 1]

type Write = [ComponentTypeId; 0]

impl<'data, T: Component> View<'data> for TryRead<T>[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = Slice<'data, T>

type Iter = TryReadIter<'data, T>

type Read = [ComponentTypeId; 1]

type Write = [ComponentTypeId; 0]

impl<'data, T: Component> View<'data> for TryWrite<T>[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = Slice<'data, T>

type Iter = TryWriteIter<'data, T>

type Read = [ComponentTypeId; 1]

type Write = [ComponentTypeId; 1]

impl<'data, T: Component> View<'data> for Write<T>[src]

type Element = <Self::Fetch as IntoIndexableIter>::Item

type Fetch = WriteFetch<'data, T>

type Iter = WriteIter<'data, T>

type Read = [ComponentTypeId; 1]

type Write = [ComponentTypeId; 1]

Loading content...