pub struct Query<V, F = None> { /* private fields */ }
Expand description

Defines a query to be run over a world.

This defines either a regular or parallel query (parallel requires the rayon feature to be enabled). It is essentially a marker type, simply providing the types to the calls to query() to make the API as simple to use as possible.

Example

use brood::{
    entity,
    query::{
        filter,
        result,
        views,
    },
    registry,
    Query,
    World,
};

// Define components.
struct Foo(u32);
struct Bar(bool);
struct Baz(f64);

type Registry = registry!(Foo, Bar, Baz);

let mut world = World::<Registry>::new();
world.insert(entity!(Foo(42), Bar(true), Baz(1.5)));

for result!(foo, bar) in world.query(Query::<views!(&mut Foo, &Bar), filter::Has<Baz>>::new()) {
    // Do something.
}

Implementations

Creates a new Query.

When creating a query, you must specify the views type V, and can optionally specify the filter type F. If no filter is specified, the default filter, filter::None, will be used.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a 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

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 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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. 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.