#[repr(C)]pub struct ecs_observer_desc_t {Show 14 fields
pub _canary: i32,
pub entity: ecs_entity_t,
pub filter: ecs_filter_desc_t,
pub events: [ecs_entity_t; 8],
pub yield_existing: bool,
pub callback: ecs_iter_action_t,
pub run: ecs_run_action_t,
pub ctx: *mut c_void,
pub binding_ctx: *mut c_void,
pub ctx_free: ecs_ctx_free_t,
pub binding_ctx_free: ecs_ctx_free_t,
pub observable: *mut ecs_poly_t,
pub last_event_id: *mut i32,
pub term_index: i32,
}Expand description
Used with ecs_observer_init.
\ingroup observers
Fields§
§_canary: i32§entity: ecs_entity_tExisting entity to associate with observer (optional)
filter: ecs_filter_desc_tFilter for observer
events: [ecs_entity_t; 8]Events to observe (OnAdd, OnRemove, OnSet, UnSet)
yield_existing: boolWhen observer is created, generate events from existing data. For example, EcsOnAdd Position would match all existing instances of Position. This is only supported for events that are iterable (see EcsIterable)
callback: ecs_iter_action_tCallback to invoke on an event, invoked when the observer matches.
run: ecs_run_action_tCallback invoked on an event. When left to NULL the default runner is used which matches the event with the observer’s filter, and calls ‘callback’ when it matches. A reason to override the run function is to improve performance, if there are more efficient way to test whether an event matches the observer than the general purpose query matcher.
ctx: *mut c_voidUser context to pass to callback
binding_ctx: *mut c_voidContext to be used for language bindings
ctx_free: ecs_ctx_free_tCallback to free ctx
binding_ctx_free: ecs_ctx_free_tCallback to free binding_ctx
observable: *mut ecs_poly_tObservable with which to register the observer
last_event_id: *mut i32Optional shared last event id for multiple observers. Ensures only one of the observers with the shared id gets triggered for an event
term_index: i32Used for internal purposes
Trait Implementations§
Source§impl Clone for ecs_observer_desc_t
impl Clone for ecs_observer_desc_t
Source§fn clone(&self) -> ecs_observer_desc_t
fn clone(&self) -> ecs_observer_desc_t
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more