Trait bevy_ecs::observer::TriggerTargets
source · pub trait TriggerTargets: Send + Sync + 'static {
// Required methods
fn components(&self) -> impl ExactSizeIterator<Item = ComponentId>;
fn entities(&self) -> impl ExactSizeIterator<Item = Entity>;
}
Expand description
Represents a collection of targets for a specific Trigger
of an Event
. Targets can be of type Entity
or ComponentId
.
When a trigger occurs for a given event and TriggerTargets
, any Observer
that watches for that specific event-target combination
will run.
Required Methods§
sourcefn components(&self) -> impl ExactSizeIterator<Item = ComponentId>
fn components(&self) -> impl ExactSizeIterator<Item = ComponentId>
The components the trigger should target.
sourcefn entities(&self) -> impl ExactSizeIterator<Item = Entity>
fn entities(&self) -> impl ExactSizeIterator<Item = Entity>
The entities the trigger should target.
Object Safety§
This trait is not object safe.