pub struct ParamSet<T> { /* private fields */ }Expand description
A parameter that allows disjoint access to multiple queries with conflicting access.
Normally, two queries that access the same component cannot be used together
because of Rust’s aliasing rules. ParamSet solves this by ensuring only one
query can be accessed at a time.
§Example
ⓘ
// Future: When Query is implemented
fn conflicting_access(
// These would conflict: both access Position
// query1: Query<&mut Position>,
// query2: Query<&Position, With<Player>>,
// Solution: use ParamSet
mut set: ParamSet<(Query<&mut Position>, Query<&Position, With<Player>>)>,
) {
// Access one at a time
for pos in set.p0().iter_mut() {
pos.x += 1.0;
}
// p0 is dropped before p1 is accessed
for pos in set.p1().iter() {
println!("Player position: {:?}", pos);
}
}§Note
This is a placeholder for the full ParamSet implementation, which requires Query to be implemented first (Step 3.1.3).
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for ParamSet<T>
impl<T> RefUnwindSafe for ParamSet<T>where
T: RefUnwindSafe,
impl<T> Send for ParamSet<T>where
T: Send,
impl<T> Sync for ParamSet<T>where
T: Sync,
impl<T> Unpin for ParamSet<T>where
T: Unpin,
impl<T> UnsafeUnpin for ParamSet<T>
impl<T> UnwindSafe for ParamSet<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more