pub trait ReadOnlyWorldQuery: WorldQuery { }Expand description
Marker trait for queries that only read data.
ReadOnlyWorldQuery is a marker trait that indicates a query does not
mutate any component data. This enables:
- Parallel Execution: Multiple read-only queries can run concurrently
- Shared Borrows: Can coexist with other readers of the same component
- Query Combination: Read-only queries can be combined more freely
§Safety
Implementors must ensure that the query never mutates component data, even when given a mutable world reference.
§Built-in Implementations
&TwhereT: ComponentEntityOption<Q>whereQ: ReadOnlyWorldQuery- Tuples of read-only queries
With<T>andWithout<T>filters
§Example
use goud_engine::ecs::Entity;
use goud_engine::ecs::query::ReadOnlyWorldQuery;
// Entity is always read-only
fn requires_read_only<Q: ReadOnlyWorldQuery>() {}
requires_read_only::<Entity>();Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.