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
sourceimpl<V, F> Query<V, F>
impl<V, F> Query<V, F>
sourcepub fn new() -> Self
pub fn new() -> Self
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
impl<V, F> Copy for Query<V, F>
Auto Trait Implementations
impl<V, F> RefUnwindSafe for Query<V, F>where
F: RefUnwindSafe,
V: RefUnwindSafe,
impl<V, F> Send for Query<V, F>where
F: Send,
V: Send,
impl<V, F> Sync for Query<V, F>where
F: Sync,
V: Sync,
impl<V, F> Unpin for Query<V, F>where
F: Unpin,
V: Unpin,
impl<V, F> UnwindSafe for Query<V, F>where
F: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more