[]Derive Macro hecs::Query

#[derive(Query)]

Implement Query for a struct

Queries structs can be passed to the type parameter of World::query. They must have exactly one lifetime parameter, and all of their fields must be queries (e.g. references) using that lifetime.

Example

This example is not tested
#[derive(Query, Debug, PartialEq)]
struct Foo<'a> {
    x: &'a i32,
    y: &'a mut bool,
}

let mut world = World::new();
let e = world.spawn((42, false));
assert_eq!(
    world.query_one_mut::<Foo>(e).unwrap(),
    Foo {
        x: &42,
        y: &mut false
    }
);