Struct oxygengine_core::ecs::Satisfies [−][src]
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)));