Trait termite::WorldQuery
source · pub unsafe trait WorldQuery {
type Item<'w>;
type Fetch<'w>;
type State: Send + Sync + Sized;
type ReadOnly: ReadOnlyWorldQuery<State = Self::State>;
unsafe fn init_fetch<'w>(
world: &'w World,
state: &Self::State,
last_change_tick: u32,
change_tick: u32
) -> Self::Fetch<'w>;
unsafe fn fetch<'w>(
fetch: &mut Self::Fetch<'w>,
entity: Entity
) -> Self::Item<'w>;
fn init_state(world: &mut World) -> Self::State;
fn update_component_access(
state: &Self::State,
access: &mut FilteredAccess<ComponentId>
);
unsafe fn filter_fetch<'w>(
_fetch: &mut Self::Fetch<'w>,
_entity: Entity
) -> bool { ... }
}
Required Associated Types
type Item<'w>
type Fetch<'w>
type State: Send + Sync + Sized
type ReadOnly: ReadOnlyWorldQuery<State = Self::State>
Required Methods
sourceunsafe fn init_fetch<'w>(
world: &'w World,
state: &Self::State,
last_change_tick: u32,
change_tick: u32
) -> Self::Fetch<'w>
unsafe fn init_fetch<'w>(
world: &'w World,
state: &Self::State,
last_change_tick: u32,
change_tick: u32
) -> Self::Fetch<'w>
Safety
state
must be the result ofWorldQuery::init_state
with the sameworld
.
sourceunsafe fn fetch<'w>(
fetch: &mut Self::Fetch<'w>,
entity: Entity
) -> Self::Item<'w>
unsafe fn fetch<'w>(
fetch: &mut Self::Fetch<'w>,
entity: Entity
) -> Self::Item<'w>
Fetch a single item from the given fetch
and entity
.
sourcefn init_state(world: &mut World) -> Self::State
fn init_state(world: &mut World) -> Self::State
Initialize the state required to fetch this query.
sourcefn update_component_access(
state: &Self::State,
access: &mut FilteredAccess<ComponentId>
)
fn update_component_access(
state: &Self::State,
access: &mut FilteredAccess<ComponentId>
)
Update the component access for this query.
Provided Methods
sourceunsafe fn filter_fetch<'w>(_fetch: &mut Self::Fetch<'w>, _entity: Entity) -> bool
unsafe fn filter_fetch<'w>(_fetch: &mut Self::Fetch<'w>, _entity: Entity) -> bool
Fetches the filter for this query.