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
.