ecs_observer_desc_t

Struct ecs_observer_desc_t 

Source
#[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_t

Existing entity to associate with observer (optional)

§filter: ecs_filter_desc_t

Filter for observer

§events: [ecs_entity_t; 8]

Events to observe (OnAdd, OnRemove, OnSet, UnSet)

§yield_existing: bool

When 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_t

Callback to invoke on an event, invoked when the observer matches.

§run: ecs_run_action_t

Callback 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_void

User context to pass to callback

§binding_ctx: *mut c_void

Context to be used for language bindings

§ctx_free: ecs_ctx_free_t

Callback to free ctx

§binding_ctx_free: ecs_ctx_free_t

Callback to free binding_ctx

§observable: *mut ecs_poly_t

Observable with which to register the observer

§last_event_id: *mut i32

Optional shared last event id for multiple observers. Ensures only one of the observers with the shared id gets triggered for an event

§term_index: i32

Used for internal purposes

Trait Implementations§

Source§

impl Clone for ecs_observer_desc_t

Source§

fn clone(&self) -> ecs_observer_desc_t

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ecs_observer_desc_t

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for ecs_observer_desc_t

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.