FilteredAccess

Struct FilteredAccess 

Source
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/write T, read U, with U
  • Query<&mut T, Without<U>> read/write T, without U 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/write T
  • Query<Option<&T>> accesses nothing

See comments the WorldQuery impls of AnyOf/Option/Or for more information.

Implementations§

Source§

impl FilteredAccess

Source

pub fn matches_everything() -> FilteredAccess

Returns a FilteredAccess which has no access and matches everything. This is the equivalent of a TRUE logic atom.

Source

pub fn matches_nothing() -> FilteredAccess

Returns a FilteredAccess which has no access and matches nothing. This is the equivalent of a FALSE logic atom.

Source

pub fn access(&self) -> &Access

Returns a reference to the underlying unfiltered access.

Source

pub fn access_mut(&mut self) -> &mut Access

Returns a mutable reference to the underlying unfiltered access.

Source

pub fn add_component_read(&mut self, index: ComponentId)

Adds access to the component given by index.

Source

pub fn add_component_write(&mut self, index: ComponentId)

Adds exclusive access to the component given by index.

Source

pub fn add_resource_read(&mut self, index: ComponentId)

Adds access to the resource given by index.

Source

pub fn add_resource_write(&mut self, index: ComponentId)

Adds exclusive access to the resource given by index.

Source

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>))>.

Source

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>))>.

Source

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.

Source

pub fn extend_access(&mut self, other: &FilteredAccess)

Adds all of the accesses from other to self.

Source

pub fn is_compatible(&self, other: &FilteredAccess) -> bool

Returns true if this and other can be active at the same time.

Source

pub fn get_conflicts(&self, other: &FilteredAccess) -> AccessConflicts

Returns a vector of elements that this and other cannot access at the same time.

Source

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>))>.

Source

pub fn read_all(&mut self)

Sets the underlying unfiltered access as having access to all indexed elements.

Source

pub fn write_all(&mut self)

Sets the underlying unfiltered access as having mutable access to all indexed elements.

Source

pub fn read_all_components(&mut self)

Sets the underlying unfiltered access as having access to all components.

Source

pub fn write_all_components(&mut self)

Sets the underlying unfiltered access as having mutable access to all components.

Source

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.

Source

pub fn with_filters(&self) -> impl Iterator<Item = ComponentId>

Returns the indices of the elements that this access filters for.

Source

pub fn without_filters(&self) -> impl Iterator<Item = ComponentId>

Returns the indices of the elements that this access filters out.

Source

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§

Source§

impl Clone for FilteredAccess

Source§

fn clone(&self) -> FilteredAccess

Returns a duplicate of the value. Read more
Source§

fn clone_from(&mut self, source: &FilteredAccess)

Performs copy-assignment from source. Read more
Source§

impl Debug for FilteredAccess

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for FilteredAccess

Source§

fn default() -> FilteredAccess

Returns the “default value” for a type. Read more
Source§

impl From<FilteredAccess> for FilteredAccessSet

Source§

fn from(filtered_access: FilteredAccess) -> FilteredAccessSet

Converts to this type from the input type.
Source§

impl PartialEq for FilteredAccess

Source§

fn eq(&self, other: &FilteredAccess) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for FilteredAccess

Source§

impl StructuralPartialEq for FilteredAccess

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

Source§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &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)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynEq for T
where T: Any + Eq,

Source§

fn dyn_eq(&self, other: &(dyn DynEq + 'static)) -> bool

This method tests for self and other values to be equal. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromWorld for T
where T: Default,

Source§

fn from_world(_world: &mut World) -> T

Creates Self using default().

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TypeData for T
where T: 'static + Send + Sync + Clone,

Source§

fn clone_type_data(&self) -> Box<dyn TypeData>

Creates a type-erased clone of this value.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<T> Settings for T
where T: 'static + Send + Sync,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,