pub struct Changed<T>(/* private fields */);Expand description
Query filter matching entities whose component T was mutated since
the last system boundary.
Changed<T> checks whether the component’s changed_tick is newer
than the world’s last_change_tick. Mutations are detected when
World::get_mut::<T>() is called, or when the component is replaced
via World::insert().
§Example
use goud_engine::ecs::{Component, World};
use goud_engine::ecs::query::Changed;
#[derive(Debug, Clone, Copy)]
struct Velocity { x: f32, y: f32 }
impl Component for Velocity {}
// Query: (&Position, Changed<Velocity>)
// Only returns entities where Velocity was modified this tick.Implementations§
Trait Implementations§
Source§impl<T: Component> WorldQuery for Changed<T>
impl<T: Component> WorldQuery for Changed<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 Changed<T>
impl<T: Component> ReadOnlyWorldQuery for Changed<T>
Auto Trait Implementations§
impl<T> Freeze for Changed<T>
impl<T> RefUnwindSafe for Changed<T>where
T: RefUnwindSafe,
impl<T> Send for Changed<T>where
T: Send,
impl<T> Sync for Changed<T>where
T: Sync,
impl<T> Unpin for Changed<T>where
T: Unpin,
impl<T> UnsafeUnpin for Changed<T>
impl<T> UnwindSafe for Changed<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().