Struct rs_ecs::QueryRef[][src]

pub struct QueryRef<'w, S> where
    S: QuerySpec
{ /* fields omitted */ }
Expand description

Borrow of the World for a Query. Required to obtain an iterator.

Implementations

Create an iterator over the entities matching the query.

Create a map of the entities matching the query.

This is an alternative to get and get_mut for repeated calls, to amortize the set-up costs.

Examples

let mut world = World::new();

let entity = world.alloc();
world.insert(entity, (42_i32, 1.0_f32));

let mut query = Query::<(&i32, &f32)>::new();
let mut query = query.borrow(&world);
let mut query = query.map();

let (i, f) = query.get(entity).unwrap();

assert_eq!(*i, 42);
assert_eq!(*f, 1.0);

Trait Implementations

Executes the destructor for this type. Read more

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

Performs the conversion.

Performs the conversion.

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.