Enum bevy_scene::SceneFilter
source · pub enum SceneFilter {
Unset,
Allowlist(HashSet<TypeId>),
Denylist(HashSet<TypeId>),
}
Expand description
A filter used to control which types can be added to a DynamicScene
.
This scene filter can be used more generically to represent a filter for any given type;
however, note that its intended usage with DynamicScene
only considers components and resources.
Adding types that are not a component or resource will have no effect when used with DynamicScene
.
Variants§
Unset
Represents an unset filter.
This is the equivalent of an empty Denylist
or an Allowlist
containing every type—
essentially, all types are permissible.
Allowing a type will convert this filter to an Allowlist
.
Similarly, denying a type will convert this filter to a Denylist
.
Allowlist(HashSet<TypeId>)
Contains the set of permitted types by their TypeId
.
Types not contained within this set should not be allowed to be saved to an associated DynamicScene
.
Denylist(HashSet<TypeId>)
Contains the set of prohibited types by their TypeId
.
Types contained within this set should not be allowed to be saved to an associated DynamicScene
.
Implementations§
source§impl SceneFilter
impl SceneFilter
sourcepub fn allow_all() -> Self
pub fn allow_all() -> Self
Creates a filter where all types are allowed.
This is the equivalent of creating an empty Denylist
.
sourcepub fn deny_all() -> Self
pub fn deny_all() -> Self
Creates a filter where all types are denied.
This is the equivalent of creating an empty Allowlist
.
sourcepub fn allow_by_id(self, type_id: TypeId) -> Self
pub fn allow_by_id(self, type_id: TypeId) -> Self
sourcepub fn deny_by_id(self, type_id: TypeId) -> Self
pub fn deny_by_id(self, type_id: TypeId) -> Self
sourcepub fn is_allowed<T: Any>(&self) -> bool
pub fn is_allowed<T: Any>(&self) -> bool
Returns true if the given type, T
, is allowed by the filter.
If the filter is Unset
, this will always return true
.
sourcepub fn is_allowed_by_id(&self, type_id: TypeId) -> bool
pub fn is_allowed_by_id(&self, type_id: TypeId) -> bool
Returns true if the given type is allowed by the filter.
If the filter is Unset
, this will always return true
.
sourcepub fn is_denied<T: Any>(&self) -> bool
pub fn is_denied<T: Any>(&self) -> bool
Returns true if the given type, T
, is denied by the filter.
If the filter is Unset
, this will always return false
.
sourcepub fn is_denied_by_id(&self, type_id: TypeId) -> bool
pub fn is_denied_by_id(&self, type_id: TypeId) -> bool
Returns true if the given type is denied by the filter.
If the filter is Unset
, this will always return false
.
sourcepub fn iter(&self) -> Box<dyn ExactSizeIterator<Item = &TypeId> + '_>
pub fn iter(&self) -> Box<dyn ExactSizeIterator<Item = &TypeId> + '_>
Returns an iterator over the items in the filter.
If the filter is Unset
, this will return an empty iterator.
Trait Implementations§
source§impl Clone for SceneFilter
impl Clone for SceneFilter
source§fn clone(&self) -> SceneFilter
fn clone(&self) -> SceneFilter
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SceneFilter
impl Debug for SceneFilter
source§impl Default for SceneFilter
impl Default for SceneFilter
source§fn default() -> SceneFilter
fn default() -> SceneFilter
source§impl IntoIterator for SceneFilter
impl IntoIterator for SceneFilter
source§impl PartialEq for SceneFilter
impl PartialEq for SceneFilter
source§fn eq(&self, other: &SceneFilter) -> bool
fn eq(&self, other: &SceneFilter) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for SceneFilter
impl StructuralEq for SceneFilter
impl StructuralPartialEq for SceneFilter
Auto Trait Implementations§
impl RefUnwindSafe for SceneFilter
impl Send for SceneFilter
impl Sync for SceneFilter
impl Unpin for SceneFilter
impl UnwindSafe for SceneFilter
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§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>
. 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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
.