pub unsafe trait Fetch<'world> {
type Item;
type State: FetchState;
const IS_DENSE: bool;
const IS_ARCHETYPAL: bool;
unsafe fn init(
world: &'world World,
state: &Self::State,
last_change_tick: u32,
change_tick: u32
) -> Self;
unsafe fn set_archetype(
&mut self,
state: &Self::State,
archetype: &'world Archetype,
tables: &'world Tables
);
unsafe fn set_table(&mut self, state: &Self::State, table: &'world Table);
unsafe fn archetype_fetch(&mut self, archetype_index: usize) -> Self::Item;
unsafe fn table_fetch(&mut self, table_row: usize) -> Self::Item;
fn update_component_access(
state: &Self::State,
access: &mut FilteredAccess<ComponentId>
);
fn update_archetype_component_access(
state: &Self::State,
archetype: &Archetype,
access: &mut Access<ArchetypeComponentId>
);
unsafe fn archetype_filter_fetch(&mut self, archetype_index: usize) -> bool { ... }
unsafe fn table_filter_fetch(&mut self, table_row: usize) -> bool { ... }
}
Expand description
Returns true if (and only if) every table of every archetype matched by this fetch contains
all of the matched components. This is used to select a more efficient “table iterator”
for “dense” queries. If this returns true, Fetch::set_table
and Fetch::table_fetch
will be called for iterators. If this returns false, Fetch::set_archetype
and
Fetch::archetype_fetch
will be called for iterators.
Returns true if (and only if) this Fetch relies strictly on archetypes to limit which
components are accessed by the Query.
This enables optimizations for crate::query::QueryIter
that rely on knowing exactly how
many elements are being iterated (such as Iterator::collect()
).
Creates a new instance of this fetch.
state
must have been initialized (via FetchState::init
) using the same world
passed
in to this function.
Adjusts internal state to account for the next Archetype
. This will always be called on
archetypes that match this Fetch
.
archetype
and tables
must be from the World
Fetch::init
was called on. state
must
be the Self::State
this was initialized with.
Adjusts internal state to account for the next Table
. This will always be called on tables
that match this Fetch
.
table
must be from the World
Fetch::init
was called on. state
must be the
Self::State
this was initialized with.
Fetch Self::Item
for the given table_row
in the current Table
. This must always be
called after Fetch::set_table
with a table_row
in the range of the current Table
Must always be called after Fetch::set_table
. table_row
must be in the range of the
current table
Must always be called after Fetch::set_archetype
. archetype_index
must be in the range
of the current archetype.
Must always be called after Fetch::set_table
. table_row
must be in the range of the
current table.
impl<'w, F0> Fetch<'w> for Or<(OrFetch<'w, F0>,)> where
F0: Fetch<'w>,
impl<'w, F0, F1> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
impl<'w, F0, F1, F2> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
impl<'w, F0, F1, F2> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
impl<'w, F0, F1, F2, F3> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool), (F3, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
impl<'w, F0, F1, F2, F3> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>, OrFetch<'w, F3>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool), (F3, bool), (F4, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>, OrFetch<'w, F3>, OrFetch<'w, F4>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool), (F3, bool), (F4, bool), (F5, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>, OrFetch<'w, F3>, OrFetch<'w, F4>, OrFetch<'w, F5>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool), (F3, bool), (F4, bool), (F5, bool), (F6, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>, OrFetch<'w, F3>, OrFetch<'w, F4>, OrFetch<'w, F5>, OrFetch<'w, F6>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool), (F3, bool), (F4, bool), (F5, bool), (F6, bool), (F7, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>, OrFetch<'w, F3>, OrFetch<'w, F4>, OrFetch<'w, F5>, OrFetch<'w, F6>, OrFetch<'w, F7>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool), (F3, bool), (F4, bool), (F5, bool), (F6, bool), (F7, bool), (F8, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>, OrFetch<'w, F3>, OrFetch<'w, F4>, OrFetch<'w, F5>, OrFetch<'w, F6>, OrFetch<'w, F7>, OrFetch<'w, F8>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool), (F3, bool), (F4, bool), (F5, bool), (F6, bool), (F7, bool), (F8, bool), (F9, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
F9: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>, OrFetch<'w, F3>, OrFetch<'w, F4>, OrFetch<'w, F5>, OrFetch<'w, F6>, OrFetch<'w, F7>, OrFetch<'w, F8>, OrFetch<'w, F9>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
F9: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool), (F3, bool), (F4, bool), (F5, bool), (F6, bool), (F7, bool), (F8, bool), (F9, bool), (F10, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
F9: Fetch<'w>,
F10: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>, OrFetch<'w, F3>, OrFetch<'w, F4>, OrFetch<'w, F5>, OrFetch<'w, F6>, OrFetch<'w, F7>, OrFetch<'w, F8>, OrFetch<'w, F9>, OrFetch<'w, F10>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
F9: Fetch<'w>,
F10: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool), (F3, bool), (F4, bool), (F5, bool), (F6, bool), (F7, bool), (F8, bool), (F9, bool), (F10, bool), (F11, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
F9: Fetch<'w>,
F10: Fetch<'w>,
F11: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>, OrFetch<'w, F3>, OrFetch<'w, F4>, OrFetch<'w, F5>, OrFetch<'w, F6>, OrFetch<'w, F7>, OrFetch<'w, F8>, OrFetch<'w, F9>, OrFetch<'w, F10>, OrFetch<'w, F11>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
F9: Fetch<'w>,
F10: Fetch<'w>,
F11: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool), (F3, bool), (F4, bool), (F5, bool), (F6, bool), (F7, bool), (F8, bool), (F9, bool), (F10, bool), (F11, bool), (F12, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
F9: Fetch<'w>,
F10: Fetch<'w>,
F11: Fetch<'w>,
F12: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>, OrFetch<'w, F3>, OrFetch<'w, F4>, OrFetch<'w, F5>, OrFetch<'w, F6>, OrFetch<'w, F7>, OrFetch<'w, F8>, OrFetch<'w, F9>, OrFetch<'w, F10>, OrFetch<'w, F11>, OrFetch<'w, F12>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
F9: Fetch<'w>,
F10: Fetch<'w>,
F11: Fetch<'w>,
F12: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool), (F3, bool), (F4, bool), (F5, bool), (F6, bool), (F7, bool), (F8, bool), (F9, bool), (F10, bool), (F11, bool), (F12, bool), (F13, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
F9: Fetch<'w>,
F10: Fetch<'w>,
F11: Fetch<'w>,
F12: Fetch<'w>,
F13: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>, OrFetch<'w, F3>, OrFetch<'w, F4>, OrFetch<'w, F5>, OrFetch<'w, F6>, OrFetch<'w, F7>, OrFetch<'w, F8>, OrFetch<'w, F9>, OrFetch<'w, F10>, OrFetch<'w, F11>, OrFetch<'w, F12>, OrFetch<'w, F13>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
F9: Fetch<'w>,
F10: Fetch<'w>,
F11: Fetch<'w>,
F12: Fetch<'w>,
F13: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14> Fetch<'w> for AnyOf<((F0, bool), (F1, bool), (F2, bool), (F3, bool), (F4, bool), (F5, bool), (F6, bool), (F7, bool), (F8, bool), (F9, bool), (F10, bool), (F11, bool), (F12, bool), (F13, bool), (F14, bool))> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
F9: Fetch<'w>,
F10: Fetch<'w>,
F11: Fetch<'w>,
F12: Fetch<'w>,
F13: Fetch<'w>,
F14: Fetch<'w>,
impl<'w, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14> Fetch<'w> for Or<(OrFetch<'w, F0>, OrFetch<'w, F1>, OrFetch<'w, F2>, OrFetch<'w, F3>, OrFetch<'w, F4>, OrFetch<'w, F5>, OrFetch<'w, F6>, OrFetch<'w, F7>, OrFetch<'w, F8>, OrFetch<'w, F9>, OrFetch<'w, F10>, OrFetch<'w, F11>, OrFetch<'w, F12>, OrFetch<'w, F13>, OrFetch<'w, F14>)> where
F0: Fetch<'w>,
F1: Fetch<'w>,
F2: Fetch<'w>,
F3: Fetch<'w>,
F4: Fetch<'w>,
F5: Fetch<'w>,
F6: Fetch<'w>,
F7: Fetch<'w>,
F8: Fetch<'w>,
F9: Fetch<'w>,
F10: Fetch<'w>,
F11: Fetch<'w>,
F12: Fetch<'w>,
F13: Fetch<'w>,
F14: Fetch<'w>,