Struct flatbox_ecs::Added
source · pub struct Added<T>(/* private fields */);
Expand description
Query that retrieves added state of type T
component.
It is your responsibility to clear trackers with World::clear_trackers()
at the start of the frame (or any other suitable moment).
§Example
let mut world = World::new();
let e = world.spawn((123,));
for (_id, (value, value_add)) in world.query::<(&i32, Added<i32>)>().iter() {
assert_eq!(*value, 123);
assert_eq!(value_add, true);
}
world.clear_trackers();
for (_id, value_add) in world.query::<Added<i32>>().iter() {
assert_eq!(value_add, false);
}
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Added<T>
impl<T> RefUnwindSafe for Added<T>
impl<T> Send for Added<T>
impl<T> Sync for Added<T>
impl<T> Unpin for Added<T>
impl<T> UnwindSafe for Added<T>
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<'a, Q> ComponentBorrow for Qwhere
Q: Query,
impl<'a, Q> ComponentBorrow for Qwhere
Q: Query,
source§impl<T> Downcast for T
impl<T> Downcast for T
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<'a, Q> Subset for Qwhere
Q: Query,
impl<'a, Q> Subset for Qwhere
Q: Query,
source§fn is_subset<U>() -> boolwhere
U: ComponentBorrow,
fn is_subset<U>() -> boolwhere
U: ComponentBorrow,
Returns true if U is a subset of Self
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.