pub struct Satisfies<Q>(_);
Expand description
A query that yields true
iff an entity would satisfy the 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more