pub struct Satisfies<Q>(/* private fields */);
Expand description
A query that matches all entities, yielding bool
s indicating whether each satisfies query Q
Does not borrow any components, making it faster and more concurrency-friendly than Option<Q>
.
Example
let mut world = World::new();
let a = world.spawn((123, true, "abc"));
let b = world.spawn((456, false));
let c = world.spawn((42, "def"));
let entities = world.query::<Satisfies<&bool>>()
.iter()
.map(|(e, x)| (e, x))
.collect::<Vec<_>>();
assert_eq!(entities.len(), 3);
assert!(entities.contains(&(a, true)));
assert!(entities.contains(&(b, true)));
assert!(entities.contains(&(c, false)));
Trait Implementations§
Auto Trait Implementations§
impl<Q> RefUnwindSafe for Satisfies<Q>where
Q: RefUnwindSafe,
impl<Q> Send for Satisfies<Q>where
Q: Send,
impl<Q> Sync for Satisfies<Q>where
Q: Sync,
impl<Q> Unpin for Satisfies<Q>where
Q: Unpin,
impl<Q> UnwindSafe for Satisfies<Q>where
Q: 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