pub struct Has<T>(PhantomData<fn() -> T>);Expand description
Yields whether the archetype carries T.
The answer is read from the archetype’s component set, so it reaches no value
and never conflicts: (&mut T, Has<T>) is legal. Use it instead of
Option<&T>::is_some() to ask about a component without borrowing it.
It narrows nothing: every archetype matches, and a row whose archetype lacks
T yields false. That is what lets a query report presence for rows it
was going to visit anyway, and what keeps query_one::<Has<T>> answering
Ok(false) rather than an error for an entity that lacks T. To visit
only the archetypes carrying T, pair it with
crate::QueryBorrow::by: .by(|archetype: &Archetype| archetype.has::<T>()).
Tuple Fields§
§0: PhantomData<fn() -> T>Trait Implementations§
impl<T: Copy> Copy for Has<T>
Auto Trait Implementations§
impl<T> Forget for Has<T>
impl<T> Freeze for Has<T>
impl<T> RefUnwindSafe for Has<T>
impl<T> Send for Has<T>
impl<T> Sync for Has<T>
impl<T> Unpin for Has<T>
impl<T> UnsafeUnpin for Has<T>
impl<T> UnwindSafe for Has<T>
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