Struct FilteredAccess
pub struct FilteredAccess { /* 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, withUQuery<&mut T, Without<U>>read/writeT, withoutUfrom 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/writeTQuery<Option<&T>>accesses nothing
See comments the WorldQuery impls of AnyOf/Option/Or for more information.
Implementations§
§impl FilteredAccess
impl FilteredAccess
pub fn matches_everything() -> FilteredAccess
pub fn matches_everything() -> FilteredAccess
Returns a FilteredAccess which has no access and matches everything.
This is the equivalent of a TRUE logic atom.
pub fn matches_nothing() -> FilteredAccess
pub fn matches_nothing() -> FilteredAccess
Returns a FilteredAccess which has no access and matches nothing.
This is the equivalent of a FALSE logic atom.
pub fn access_mut(&mut self) -> &mut Access
pub fn access_mut(&mut self) -> &mut Access
Returns a mutable reference to the underlying unfiltered access.
pub fn add_component_read(&mut self, index: ComponentId)
👎Deprecated since 0.19.0: use FilteredAccess::add_read
pub fn add_component_read(&mut self, index: ComponentId)
use FilteredAccess::add_read
Adds access to the component given by index.
pub fn add_read(&mut self, index: ComponentId)
pub fn add_read(&mut self, index: ComponentId)
Adds access to the component given by index.
pub fn add_component_write(&mut self, index: ComponentId)
👎Deprecated since 0.19.0: use FilteredAccess::add_write
pub fn add_component_write(&mut self, index: ComponentId)
use FilteredAccess::add_write
Adds exclusive access to the component given by index.
pub fn add_write(&mut self, index: ComponentId)
pub fn add_write(&mut self, index: ComponentId)
Adds exclusive access to the component given by index.
pub fn and_with(&mut self, index: ComponentId)
pub fn and_with(&mut self, index: ComponentId)
Adds a With filter: corresponds to a conjunction (AND) operation.
Suppose we begin with Or<(With<A>, With<B>)>, which is represented by an array of two AccessFilter instances.
Adding AND With<C> via this method transforms it into the equivalent of Or<((With<A>, With<C>), (With<B>, With<C>))>.
pub fn and_without(&mut self, index: ComponentId)
pub fn and_without(&mut self, index: ComponentId)
Adds a Without filter: corresponds to a conjunction (AND) operation.
Suppose we begin with Or<(With<A>, With<B>)>, which is represented by an array of two AccessFilter instances.
Adding AND Without<C> via this method transforms it into the equivalent of Or<((With<A>, Without<C>), (With<B>, Without<C>))>.
pub fn append_or(&mut self, other: &FilteredAccess)
pub fn append_or(&mut self, other: &FilteredAccess)
Appends an array of filters: corresponds to a disjunction (OR) operation.
As the underlying array of filters represents a disjunction,
where each element (AccessFilters) represents a conjunction,
we can simply append to the array.
pub fn extend_access(&mut self, other: &FilteredAccess)
pub fn extend_access(&mut self, other: &FilteredAccess)
Adds all of the accesses from other to self.
pub fn is_compatible(&self, other: &FilteredAccess) -> bool
pub fn is_compatible(&self, other: &FilteredAccess) -> bool
Returns true if this and other can be active at the same time.
pub fn get_conflicts(&self, other: &FilteredAccess) -> AccessConflicts
pub fn get_conflicts(&self, other: &FilteredAccess) -> AccessConflicts
Returns a vector of elements that this and other cannot access at the same time.
pub fn extend(&mut self, other: &FilteredAccess)
pub fn extend(&mut self, other: &FilteredAccess)
Adds all access and filters from other.
Corresponds to a conjunction operation (AND) for filters.
Extending Or<(With<A>, Without<B>)> with Or<(With<C>, Without<D>)> will result in
Or<((With<A>, With<C>), (With<A>, Without<D>), (Without<B>, With<C>), (Without<B>, Without<D>))>.
pub fn read_all(&mut self)
pub fn read_all(&mut self)
Sets the underlying unfiltered access as having access to all components.
pub fn write_all(&mut self)
pub fn write_all(&mut self)
Sets the underlying unfiltered access as having mutable access to all components.
pub fn read_all_components(&mut self)
👎Deprecated since 0.19.0: use FilteredAccess::read_all
pub fn read_all_components(&mut self)
use FilteredAccess::read_all
Sets the underlying unfiltered access as having access to all components.
pub fn write_all_components(&mut self)
👎Deprecated since 0.19.0: use FilteredAccess::write_all
pub fn write_all_components(&mut self)
use FilteredAccess::write_all
Sets the underlying unfiltered access as having mutable access to all components.
pub fn is_subset(&self, other: &FilteredAccess) -> bool
pub fn is_subset(&self, other: &FilteredAccess) -> bool
Returns true if the set is a subset of another, i.e. other contains
at least all the values in self.
pub fn required(&self) -> &ComponentIdSet
pub fn required(&self) -> &ComponentIdSet
Returns the set of components that must be present for this access to match.
These components will also be included in the AccessFilters::with collection
for every filter in Self::filter_sets.
This is used by query transmutes to ensure that
components read by the query are present.
This will include components from query types like &C,
but not from filters like With<C>,
and not from optional data like Option<&C>.
pub fn filter_sets(&self) -> &[AccessFilters]
pub fn filter_sets(&self) -> &[AccessFilters]
The list of filters, expressed in disjunctive normal form.
This FilteredAccess will match an entity if
any of the AccessFilters matches the entity.
pub fn with_filters(&self) -> impl Iterator<Item = ComponentId>
pub fn with_filters(&self) -> impl Iterator<Item = ComponentId>
Returns the indices of the elements that this access filters for.
pub fn without_filters(&self) -> impl Iterator<Item = ComponentId>
pub fn without_filters(&self) -> impl Iterator<Item = ComponentId>
Returns the indices of the elements that this access filters out.
pub fn contains(&self, index: ComponentId) -> bool
pub fn contains(&self, index: ComponentId) -> bool
Returns true if the index is used by this FilteredAccess in filters or archetypal access.
This includes most ways to access a component, but notably excludes EntityRef and EntityMut
along with anything inside Option<T>.
Trait Implementations§
§impl Clone for FilteredAccess
impl Clone for FilteredAccess
§fn clone(&self) -> FilteredAccess
fn clone(&self) -> FilteredAccess
§fn clone_from(&mut self, source: &FilteredAccess)
fn clone_from(&mut self, source: &FilteredAccess)
source. Read more§impl Debug for FilteredAccess
impl Debug for FilteredAccess
§impl Default for FilteredAccess
impl Default for FilteredAccess
§fn default() -> FilteredAccess
fn default() -> FilteredAccess
§impl From<FilteredAccess> for FilteredAccessSet
impl From<FilteredAccess> for FilteredAccessSet
§fn from(filtered_access: FilteredAccess) -> FilteredAccessSet
fn from(filtered_access: FilteredAccess) -> FilteredAccessSet
§impl PartialEq for FilteredAccess
impl PartialEq for FilteredAccess
impl Eq for FilteredAccess
impl StructuralPartialEq for FilteredAccess
Auto Trait Implementations§
impl Freeze for FilteredAccess
impl RefUnwindSafe for FilteredAccess
impl Send for FilteredAccess
impl Sync for FilteredAccess
impl Unpin for FilteredAccess
impl UnsafeUnpin for FilteredAccess
impl UnwindSafe for FilteredAccess
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> FromTemplate for T
impl<T> FromTemplate for T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.§impl<T> Template for T
impl<T> Template for T
§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.