pub fn prepared_query<'q, Q>(
        &'q self,
        prepared_query: &'q mut PreparedQuery<Q>,
    ) -> PreparedQueryBorrow<'q, Q>
    where
        Q: Query + Send + Sync,
    {
        prepared_query.query(self.world)
    }
/// Perform a query with a cache of the query results. See [`PreparedQuery`] for more.
///
/// # Example
/// ```rust
/// # use hv_yaks::{SystemContext};
/// # use hv_ecs::PreparedQuery;
/// # struct Pos;
/// # #[derive(Clone, Copy)]
/// # struct Vel;
/// # impl std::ops::AddAssign<Vel> for Pos {
/// #     fn add_assign(&mut self, _: Vel) {}
/// # }
/// # let world = hv_ecs::World::new();
/// fn some_system(
///     context: SystemContext,
///     _resources: (),
///     query: &mut PreparedQuery<(&mut Pos, &Vel)>
/// ) {
///     for (_entity, (pos, vel)) in context.prepared_query(query).iter() {
///         *pos += *vel;
///     }
/// };
/// ```
Perform a query with a cache of the query results. See [`PreparedQuery`] for more.
Perform a query with a cache of the query results . See [ ` PreparedQuery ` ] for more .
pub fn prepared_query<'q, Q>(
        &'q self,
        prepared_query: &'q mut PreparedQuery<Q>,
    ) -> PreparedQueryBorrow<'q, Q>
    where
        Q: Query + Send + Sync,
    {
        prepared_query.query(self.world)
    }
pub fn prepared_query < ' q , Q > ( & ' q self , prepared_query : & ' q mut PreparedQuery < Q > , ) -> PreparedQueryBorrow < ' q , Q > where Q : Query + Send + Sync , { prepared_query . query ( self . world ) }
Perform a query with a cache of the query results.
Perform a query with a cache of the query results .
&'q self
prepared_query
&'q mut PreparedQuery<Q>
&'q self
prepared_query
&'q mut PreparedQuery<Q>
example
None
use hv_yaks::{systemcontext};
None
use hv_ecs::preparedquery;
None
struct pos;
None
#[derive(clone, copy)]
None
struct vel;
None
impl std::ops::addassign<vel> for pos {
None
fn add_assign(&mut self, _: vel) {}
None
}
None
let world = hv_ecs::world::new();
fn some_system(
context: SystemContext,
_resources: (),
query: &mut PreparedQuery<(&mut Pos, &Vel)>
) {
for (_entity, (pos, vel)) in context.prepared_query(query).iter() {
pos += *vel;
}
};
```
fn some_system ( context : SystemContext _resources : () query : &mut PreparedQuery< ( &mut Pos &Vel ) > ) { for ( _entity ( pos vel )) in context . prepared_query ( query ) . iter () { pos + = * vel ; } } ; ` ` `