pub unsafe trait WorldQuery {
type Item<'w>;
type Fetch<'w>;
type State: Send + Sync + Sized;
type ReadOnly: ReadOnlyWorldQuery<State = Self::State>;
// Required methods
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>,
);
// Provided method
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.
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.