pub struct With<Q>(/* private fields */);
Expand description
A Query
which matches if query Q
matches.
Unlike Q
however, With<Q>
does not provide access to the data returned
by Q
. This is useful for avoiding access conflicts.
Example: &C
requires read-only access to component C
, but With<&C>
does not require access at all.
Implementations§
Trait Implementations§
Source§impl<Q> Query for With<Q>where
Q: Query,
impl<Q> Query for With<Q>where
Q: Query,
Source§type Item<'a> = With<Q>
type Item<'a> = With<Q>
The item returned by this query. This is usually the same type as
Self
, but with a modified lifetime.Source§type State = <Q as Query>::State
type State = <Q as Query>::State
Cached data for fetch initialization, e.g. component indices.
Source§fn init(
world: &mut World,
config: &mut HandlerConfig,
) -> Result<(ComponentAccess, <With<Q> as Query>::State), InitError>
fn init( world: &mut World, config: &mut HandlerConfig, ) -> Result<(ComponentAccess, <With<Q> as Query>::State), InitError>
Initialize the query. Returns an expression describing the components
accessed by the query and a new instance of
Self::State
.Source§fn new_state(world: &mut World) -> <With<Q> as Query>::State
fn new_state(world: &mut World) -> <With<Q> as Query>::State
Returns a new
Self::State
instance.impl<Q> Copy for With<Q>
impl<Q> ReadOnlyQuery for With<Q>where
Q: Query,
Auto Trait Implementations§
impl<Q> Freeze for With<Q>
impl<Q> RefUnwindSafe for With<Q>
impl<Q> Send for With<Q>
impl<Q> Sync for With<Q>
impl<Q> Unpin for With<Q>
impl<Q> UnwindSafe for With<Q>
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