pub struct With<T>(/* private fields */);Expand description
Query filter that matches entities that have a component.
With<T> is a filter, not a data fetch. It filters entities to only those
that have component T, but doesn’t actually retrieve the component data.
Use With<T> when you need to ensure an entity has a component but don’t
need to access its data.
§Example
use goud_engine::ecs::{Component, World};
use goud_engine::ecs::query::With;
struct Player;
impl Component for Player {}
struct Health(f32);
impl Component for Health {}
// Query for Health, but only for entities that also have Player
// (Health, With<Player>) - fetches Health data, filters by PlayerImplementations§
Trait Implementations§
Source§impl<T: Component> WorldQuery for With<T>
impl<T: Component> WorldQuery for With<T>
Source§type State = ComponentId
type State = ComponentId
The cached state for this query. Read more
Source§fn init_state(_world: &World) -> Self::State
fn init_state(_world: &World) -> Self::State
Initializes the query state from the world. Read more
Source§fn component_access(_state: &Self::State) -> BTreeSet<ComponentId>
fn component_access(_state: &Self::State) -> BTreeSet<ComponentId>
Returns the set of component IDs this query reads. Read more
Source§fn matches_archetype(state: &Self::State, archetype: &Archetype) -> bool
fn matches_archetype(state: &Self::State, archetype: &Archetype) -> bool
Checks whether this query matches the given archetype. Read more
impl<T: Copy> Copy for With<T>
impl<T: Component> ReadOnlyWorldQuery for With<T>
Auto Trait Implementations§
impl<T> Freeze for With<T>
impl<T> RefUnwindSafe for With<T>where
T: RefUnwindSafe,
impl<T> Send for With<T>where
T: Send,
impl<T> Sync for With<T>where
T: Sync,
impl<T> Unpin for With<T>where
T: Unpin,
impl<T> UnsafeUnpin for With<T>
impl<T> UnwindSafe for With<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().