Struct bevy_ecs::observer::ObserverState
source · pub struct ObserverState { /* private fields */ }
Expand description
Contains Observer
information. This defines how a given observer behaves. It is the
“source of truth” for a given observer entity’s behavior.
Implementations§
source§impl ObserverState
impl ObserverState
sourcepub fn with_event(self, event: ComponentId) -> Self
pub fn with_event(self, event: ComponentId) -> Self
Observe the given event
. This will cause the Observer
to run whenever an event with the given ComponentId
is triggered.
sourcepub fn with_events(self, events: impl IntoIterator<Item = ComponentId>) -> Self
pub fn with_events(self, events: impl IntoIterator<Item = ComponentId>) -> Self
Observe the given event list. This will cause the Observer
to run whenever an event with any of the given ComponentId
s
is triggered.
sourcepub fn with_entities(self, entities: impl IntoIterator<Item = Entity>) -> Self
pub fn with_entities(self, entities: impl IntoIterator<Item = Entity>) -> Self
sourcepub fn with_components(
self,
components: impl IntoIterator<Item = ComponentId>
) -> Self
pub fn with_components( self, components: impl IntoIterator<Item = ComponentId> ) -> Self
Observe the given ComponentId
list. This will cause the Observer
to run whenever the Event
is triggered
for any ComponentId
target in the list.
Trait Implementations§
source§impl Component for ObserverState
impl Component for ObserverState
source§const STORAGE_TYPE: StorageType = StorageType::SparseSet
const STORAGE_TYPE: StorageType = StorageType::SparseSet
A constant indicating the storage type used for this component.
source§fn register_component_hooks(hooks: &mut ComponentHooks)
fn register_component_hooks(hooks: &mut ComponentHooks)
Called when registering this component, allowing mutable access to its
ComponentHooks
.Auto Trait Implementations§
impl Freeze for ObserverState
impl RefUnwindSafe for ObserverState
impl Send for ObserverState
impl Sync for ObserverState
impl Unpin for ObserverState
impl UnwindSafe for ObserverState
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
source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId) )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
source§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>)
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>) )
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>
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>
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)
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)
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> DowncastSync for T
impl<T> DowncastSync for T
source§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
fn get_components(self, func: &mut impl FnMut(StorageType, OwningPtr<'_>))
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
Creates
Self
using data from the given World
.