Skip to main content

goud_engine/ecs/system/system_param/
param_set.rs

1//! [`ParamSet`] — disjoint access to multiple conflicting queries.
2
3// =============================================================================
4// ParamSet
5// =============================================================================
6
7/// A parameter that allows disjoint access to multiple queries with conflicting access.
8///
9/// Normally, two queries that access the same component cannot be used together
10/// because of Rust's aliasing rules. `ParamSet` solves this by ensuring only one
11/// query can be accessed at a time.
12///
13/// # Example
14///
15/// ```ignore
16/// // Future: When Query is implemented
17/// fn conflicting_access(
18///     // These would conflict: both access Position
19///     // query1: Query<&mut Position>,
20///     // query2: Query<&Position, With<Player>>,
21///
22///     // Solution: use ParamSet
23///     mut set: ParamSet<(Query<&mut Position>, Query<&Position, With<Player>>)>,
24/// ) {
25///     // Access one at a time
26///     for pos in set.p0().iter_mut() {
27///         pos.x += 1.0;
28///     }
29///     // p0 is dropped before p1 is accessed
30///     for pos in set.p1().iter() {
31///         println!("Player position: {:?}", pos);
32///     }
33/// }
34/// ```
35///
36/// # Note
37///
38/// This is a placeholder for the full ParamSet implementation, which requires
39/// Query to be implemented first (Step 3.1.3).
40#[derive(Debug)]
41pub struct ParamSet<T> {
42    _marker: std::marker::PhantomData<T>,
43}
44
45// ParamSet implementations will be added when Query is implemented (Step 3.1.3)