Struct hecs::Satisfies

source ·
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§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.