Open
Description
Problem
Given a &World
, I cannot issue a query that only reads from the world.
There are two possible methods on World
for this: query
, query_filtered
, plus SystemState::new()
. All of them require &mut World
, as they could provide mutating type parameters.
Proposed Solutions
Quick-and-dirty
Make read-only variants of all three methods.
Ergonomic
Add a system_state
and read_only_system_state
method to World
, which generates a SystemState
and then immediately calls .get_mut
/ .get
on it.
This allows users to do things like:
let query = world.read_only_system_state::<Query<(&Foo, &Bar), With<Bat>>>();
for (foo, bar) in query.iter(){
}