Struct bevy_ecs::query::FilteredAccess
source · pub struct FilteredAccess<T: SparseSetIndex> { /* private fields */ }
Expand description
An Access
that has been filtered to include and exclude certain combinations of elements.
Used internally to statically check if queries are disjoint.
Subtle: a read
or write
in access
should not be considered to imply a
with
access.
For example consider Query<Option<&T>>
this only has a read
of T
as doing
otherwise would allow for queries to be considered disjoint when they shouldn’t:
Query<(&mut T, Option<&U>)>
read/writeT
, readU
, withU
Query<&mut T, Without<U>>
read/writeT
, withoutU
from this we could reasonably conclude that the queries are disjoint but they aren’t.
In order to solve this the actual access that Query<(&mut T, Option<&U>)>
has
is read/write T
, read U
. It must still have a read U
access otherwise the following
queries would be incorrectly considered disjoint:
Query<&mut T>
read/writeT
Query<Option<&T>
accesses nothing
See comments the WorldQuery
impls of AnyOf
/Option
/Or
for more information.
Implementations§
source§impl<T: SparseSetIndex> FilteredAccess<T>
impl<T: SparseSetIndex> FilteredAccess<T>
sourcepub fn access_mut(&mut self) -> &mut Access<T>
pub fn access_mut(&mut self) -> &mut Access<T>
Returns a mutable reference to the underlying unfiltered access.
sourcepub fn add_with(&mut self, index: T)
pub fn add_with(&mut self, index: T)
Retains only combinations where the element given by index
is also present.
sourcepub fn add_without(&mut self, index: T)
pub fn add_without(&mut self, index: T)
Retains only combinations where the element given by index
is not present.
pub fn extend_intersect_filter(&mut self, other: &FilteredAccess<T>)
pub fn extend_access(&mut self, other: &FilteredAccess<T>)
sourcepub fn is_compatible(&self, other: &FilteredAccess<T>) -> bool
pub fn is_compatible(&self, other: &FilteredAccess<T>) -> bool
Returns true
if this and other
can be active at the same time.
sourcepub fn get_conflicts(&self, other: &FilteredAccess<T>) -> Vec<T>
pub fn get_conflicts(&self, other: &FilteredAccess<T>) -> Vec<T>
Returns a vector of elements that this and other
cannot access at the same time.
sourcepub fn extend(&mut self, access: &FilteredAccess<T>)
pub fn extend(&mut self, access: &FilteredAccess<T>)
Adds all access and filters from other
.
Trait Implementations§
source§impl<T: Clone + SparseSetIndex> Clone for FilteredAccess<T>
impl<T: Clone + SparseSetIndex> Clone for FilteredAccess<T>
source§fn clone(&self) -> FilteredAccess<T>
fn clone(&self) -> FilteredAccess<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<T: SparseSetIndex + Debug> Debug for FilteredAccess<T>
impl<T: SparseSetIndex + Debug> Debug for FilteredAccess<T>
source§impl<T: SparseSetIndex> Default for FilteredAccess<T>
impl<T: SparseSetIndex> Default for FilteredAccess<T>
source§impl<T: SparseSetIndex> From<FilteredAccess<T>> for FilteredAccessSet<T>
impl<T: SparseSetIndex> From<FilteredAccess<T>> for FilteredAccessSet<T>
source§fn from(filtered_access: FilteredAccess<T>) -> Self
fn from(filtered_access: FilteredAccess<T>) -> Self
source§impl<T: PartialEq + SparseSetIndex> PartialEq<FilteredAccess<T>> for FilteredAccess<T>
impl<T: PartialEq + SparseSetIndex> PartialEq<FilteredAccess<T>> for FilteredAccess<T>
source§fn eq(&self, other: &FilteredAccess<T>) -> bool
fn eq(&self, other: &FilteredAccess<T>) -> bool
self
and other
values to be equal, and is used
by ==
.impl<T: Eq + SparseSetIndex> Eq for FilteredAccess<T>
impl<T: SparseSetIndex> StructuralEq for FilteredAccess<T>
impl<T: SparseSetIndex> StructuralPartialEq for FilteredAccess<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for FilteredAccess<T>where T: RefUnwindSafe,
impl<T> Send for FilteredAccess<T>where T: Send,
impl<T> Sync for FilteredAccess<T>where T: Sync,
impl<T> Unpin for FilteredAccess<T>where T: Unpin,
impl<T> UnwindSafe for FilteredAccess<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere T: Default,
source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World