Because of Rust borrow checker I'm usually forced to pass around entities and queries. But there seems to be a problem when I've got a mutable query but it suffices to have immutable one, like
fn some_function(entities: &Vec<Entity>, query: &Query<&SomeComponent>){...}
fn some_system(some_entities: Res<Vec<Entity>>, query: Query<&mut SomeComponent>)
{
for mut c in query.iter_mut() {...};
some_function(some_entities, query);
}
As far as I can see there is no way to cast the query although it seems reasonable to do so. I believe there should exist some implementation of AsRef trait or perhaps some new trait like CanQuery<ComponentType>.
Because of Rust borrow checker I'm usually forced to pass around entities and queries. But there seems to be a problem when I've got a mutable query but it suffices to have immutable one, like
As far as I can see there is no way to cast the query although it seems reasonable to do so. I believe there should exist some implementation of
AsReftrait or perhaps some new trait likeCanQuery<ComponentType>.