Struct rs_ecs::QueryMap[][src]

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

Provides random access to the entities which match a certain Query.

Implementations

Access the queried components of the given Entity

Examples
let mut world = World::new();

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

let entity2 = world.alloc();
world.insert(entity2, (23_i32,));

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

let (i1, f1) = query.get(entity1).unwrap();
let (i2, f2) = query.get(entity2).unwrap();

assert_eq!(*i1, 42);
assert_eq!(f1.copied(), Some(1.0));
assert_eq!(*i2, 23);
assert_eq!(f2.copied(), None);

Exclusively access the queried components of the given Entity

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 alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

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.