HandlerInfo

Struct HandlerInfo 

Source
pub struct HandlerInfo(/* private fields */);
Expand description

Metadata for a handler.

Implementations§

Source§

impl HandlerInfo

Source

pub fn name(&self) -> &str

Gets the name of the handler.

This name is intended for debugging purposes and should not be relied upon for correctness.

Source

pub fn id(&self) -> HandlerId

Gets the ID of this handler.

Source

pub fn type_id(&self) -> Option<TypeId>

Gets the TypeId of this handler, if any.

Source

pub fn received_event(&self) -> EventId

Gets the EventId of the event this handler listens for.

Source

pub fn received_event_access(&self) -> Access

Gets the handler’s Access to the event it listens for.

Source

pub fn targeted_event_component_access(&self) -> Option<&ComponentAccess>

Gets the expression describing the handler’s targeted event query, or None if this handler is not targeted.

Source

pub fn sent_global_events( &self, ) -> impl Iterator<Item = GlobalEventIdx> + Clone + Debug + '_

Returns an iterator over the set of global events this handler sends.

Source

pub fn sent_targeted_events( &self, ) -> impl Iterator<Item = TargetedEventIdx> + Clone + Debug + '_

Returns an iterator over the set of targeted events this handler sends.

Source

pub fn event_queue_access(&self) -> Access

Gets this handler’s Access to the event queue.

Source

pub fn component_access(&self) -> &ComponentAccess

Gets the expression describing this handler’s access

Source

pub fn archetype_filter(&self) -> &ComponentAccess

Returns the ComponentAccess used for matching archetypes.

Source

pub fn referenced_components( &self, ) -> impl Iterator<Item = ComponentIdx> + Clone + Debug + '_

Gets the set of components referenced by this handler.

Referenced components are components used by the handler in any way. Used for cleanup when removing components.

Source

pub fn references_component(&self, idx: ComponentIdx) -> bool

Does this handler reference the given component?

Source

pub fn priority(&self) -> HandlerPriority

Gets the HandlerPriority of this handler.

Trait Implementations§

Source§

impl Debug for HandlerInfo

Source§

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

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

impl HandlerParam for &HandlerInfo

Obtains the HandlerInfo for the running handler.

Source§

type State = ()

Persistent data stored in the handler.
Source§

type This<'a> = &'a HandlerInfo

The type produced by this handler param. This must be the type of Self but with the lifetime of 'a.
Source§

fn init( _world: &mut World, _config: &mut HandlerConfig, ) -> Result<Self::State, InitError>

Initializes the handler using the input World and HandlerConfig. Read more
Source§

unsafe fn get<'a>( _state: &'a mut Self::State, info: &'a HandlerInfo, _event_ptr: EventPtr<'a>, _target_location: EntityLocation, _world: UnsafeWorldCell<'a>, ) -> Self::This<'a>

Obtains a new instance of the handler parameter. Read more
Source§

fn refresh_archetype(_state: &mut Self::State, _arch: &Archetype)

Refresh an archetype for this handler param. Called whenever Handler::refresh_archetype is called.
Source§

fn remove_archetype(_state: &mut Self::State, _arch: &Archetype)

Remove the given archetype for this handler param. Called whenever Handler::remove_archetype is called.

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.