Trait flatbox_ecs::Fetch

source ·
pub unsafe trait Fetch: Sized {
    type State: Copy;

    // Required methods
    fn dangling() -> Self;
    fn access(archetype: &Archetype) -> Option<Access>;
    fn borrow(archetype: &Archetype, state: Self::State);
    fn prepare(archetype: &Archetype) -> Option<Self::State>;
    fn execute(archetype: &Archetype, state: Self::State) -> Self;
    fn release(archetype: &Archetype, state: Self::State);
    fn for_each_borrow(f: impl FnMut(TypeId, bool));
}
Expand description

Streaming iterators over contiguous homogeneous ranges of components

Required Associated Types§

source

type State: Copy

The type of the data which can be cached to speed up retrieving the relevant type states from a matching Archetype

Required Methods§

source

fn dangling() -> Self

A value on which get may never be called

source

fn access(archetype: &Archetype) -> Option<Access>

How this query will access archetype, if at all

source

fn borrow(archetype: &Archetype, state: Self::State)

Acquire dynamic borrows from archetype

source

fn prepare(archetype: &Archetype) -> Option<Self::State>

Look up state for archetype if it should be traversed

source

fn execute(archetype: &Archetype, state: Self::State) -> Self

Construct a Fetch for archetype based on the associated state

source

fn release(archetype: &Archetype, state: Self::State)

Release dynamic borrows acquired by borrow

source

fn for_each_borrow(f: impl FnMut(TypeId, bool))

Invoke f for every component type that may be borrowed and whether the borrow is unique

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Fetch for ()

§

type State = ()

source§

fn dangling()

source§

fn access(archetype: &Archetype) -> Option<Access>

source§

fn borrow(archetype: &Archetype, state: <() as Fetch>::State)

source§

fn prepare(archetype: &Archetype) -> Option<<() as Fetch>::State>

source§

fn execute(archetype: &Archetype, state: <() as Fetch>::State)

source§

fn release(archetype: &Archetype, state: <() as Fetch>::State)

source§

fn for_each_borrow(f: impl FnMut(TypeId, bool))

source§

impl<A> Fetch for (A,)
where A: Fetch,

§

type State = (<A as Fetch>::State,)

source§

fn dangling() -> (A,)

source§

fn access(archetype: &Archetype) -> Option<Access>

source§

fn borrow(archetype: &Archetype, state: <(A,) as Fetch>::State)

source§

fn prepare(archetype: &Archetype) -> Option<<(A,) as Fetch>::State>

source§

fn execute(archetype: &Archetype, state: <(A,) as Fetch>::State) -> (A,)

source§

fn release(archetype: &Archetype, state: <(A,) as Fetch>::State)

source§

fn for_each_borrow(f: impl FnMut(TypeId, bool))

source§

impl<B, A> Fetch for (B, A)
where B: Fetch, A: Fetch,

§

type State = (<B as Fetch>::State, <A as Fetch>::State)

source§

fn dangling() -> (B, A)

source§

fn access(archetype: &Archetype) -> Option<Access>

source§

fn borrow(archetype: &Archetype, state: <(B, A) as Fetch>::State)

source§

fn prepare(archetype: &Archetype) -> Option<<(B, A) as Fetch>::State>

source§

fn execute(archetype: &Archetype, state: <(B, A) as Fetch>::State) -> (B, A)

source§

fn release(archetype: &Archetype, state: <(B, A) as Fetch>::State)

source§

fn for_each_borrow(f: impl FnMut(TypeId, bool))

source§

impl<C, B, A> Fetch for (C, B, A)
where C: Fetch, B: Fetch, A: Fetch,

§

type State = (<C as Fetch>::State, <B as Fetch>::State, <A as Fetch>::State)

source§

fn dangling() -> (C, B, A)

source§

fn access(archetype: &Archetype) -> Option<Access>

source§

fn borrow(archetype: &Archetype, state: <(C, B, A) as Fetch>::State)

source§

fn prepare(archetype: &Archetype) -> Option<<(C, B, A) as Fetch>::State>

source§

fn execute( archetype: &Archetype, state: <(C, B, A) as Fetch>::State ) -> (C, B, A)

source§

fn release(archetype: &Archetype, state: <(C, B, A) as Fetch>::State)

source§

fn for_each_borrow(f: impl FnMut(TypeId, bool))

source§

impl<D, C, B, A> Fetch for (D, C, B, A)
where D: Fetch, C: Fetch, B: Fetch, A: Fetch,

§

type State = (<D as Fetch>::State, <C as Fetch>::State, <B as Fetch>::State, <A as Fetch>::State)

source§

fn dangling() -> (D, C, B, A)

source§

fn access(archetype: &Archetype) -> Option<Access>

source§

fn borrow(archetype: &Archetype, state: <(D, C, B, A) as Fetch>::State)

source§

fn prepare(archetype: &Archetype) -> Option<<(D, C, B, A) as Fetch>::State>

source§

fn execute( archetype: &Archetype, state: <(D, C, B, A) as Fetch>::State ) -> (D, C, B, A)

source§

fn release(archetype: &Archetype, state: <(D, C, B, A) as Fetch>::State)

source§

fn for_each_borrow(f: impl FnMut(TypeId, bool))

source§

impl<E, D, C, B, A> Fetch for (E, D, C, B, A)
where E: Fetch, D: Fetch, C: Fetch, B: Fetch, A: Fetch,

source§

impl<F, E, D, C, B, A> Fetch for (F, E, D, C, B, A)
where F: Fetch, E: Fetch, D: Fetch, C: Fetch, B: Fetch, A: Fetch,

source§

impl<G, F, E, D, C, B, A> Fetch for (G, F, E, D, C, B, A)
where G: Fetch, F: Fetch, E: Fetch, D: Fetch, C: Fetch, B: Fetch, A: Fetch,

source§

impl<H, G, F, E, D, C, B, A> Fetch for (H, G, F, E, D, C, B, A)
where H: Fetch, G: Fetch, F: Fetch, E: Fetch, D: Fetch, C: Fetch, B: Fetch, A: Fetch,

source§

impl<I, H, G, F, E, D, C, B, A> Fetch for (I, H, G, F, E, D, C, B, A)
where I: Fetch, H: Fetch, G: Fetch, F: Fetch, E: Fetch, D: Fetch, C: Fetch, B: Fetch, A: Fetch,

source§

impl<J, I, H, G, F, E, D, C, B, A> Fetch for (J, I, H, G, F, E, D, C, B, A)
where J: Fetch, I: Fetch, H: Fetch, G: Fetch, F: Fetch, E: Fetch, D: Fetch, C: Fetch, B: Fetch, A: Fetch,

source§

impl<K, J, I, H, G, F, E, D, C, B, A> Fetch for (K, J, I, H, G, F, E, D, C, B, A)
where K: Fetch, J: Fetch, I: Fetch, H: Fetch, G: Fetch, F: Fetch, E: Fetch, D: Fetch, C: Fetch, B: Fetch, A: Fetch,

source§

impl<L, K, J, I, H, G, F, E, D, C, B, A> Fetch for (L, K, J, I, H, G, F, E, D, C, B, A)
where L: Fetch, K: Fetch, J: Fetch, I: Fetch, H: Fetch, G: Fetch, F: Fetch, E: Fetch, D: Fetch, C: Fetch, B: Fetch, A: Fetch,

source§

impl<M, L, K, J, I, H, G, F, E, D, C, B, A> Fetch for (M, L, K, J, I, H, G, F, E, D, C, B, A)
where M: Fetch, L: Fetch, K: Fetch, J: Fetch, I: Fetch, H: Fetch, G: Fetch, F: Fetch, E: Fetch, D: Fetch, C: Fetch, B: Fetch, A: Fetch,

source§

impl<N, M, L, K, J, I, H, G, F, E, D, C, B, A> Fetch for (N, M, L, K, J, I, H, G, F, E, D, C, B, A)
where N: Fetch, M: Fetch, L: Fetch, K: Fetch, J: Fetch, I: Fetch, H: Fetch, G: Fetch, F: Fetch, E: Fetch, D: Fetch, C: Fetch, B: Fetch, A: Fetch,

source§

impl<O, N, M, L, K, J, I, H, G, F, E, D, C, B, A> Fetch for (O, N, M, L, K, J, I, H, G, F, E, D, C, B, A)
where O: Fetch, N: Fetch, M: Fetch, L: Fetch, K: Fetch, J: Fetch, I: Fetch, H: Fetch, G: Fetch, F: Fetch, E: Fetch, D: Fetch, C: Fetch, B: Fetch, A: Fetch,

Implementors§