pub struct EntityMessageDispatcher<'message> { /* private fields */ }
Expand description

The EntityMessageDispatcher is a hub for managing messages to / from the host

Use it to perform various requests and assign closures that will be called when a result is received. You need to call EntityMessageDispatcher::update somewhere in your update routine. This will in turn check if any results have been received and call the corresponding closures.

Implementations§

source§

impl<'message> EntityMessageDispatcher<'message>

source

pub fn remove_all_listeners(&mut self)

Remove all listenerers

source

pub fn spatial_query_in_global_queue<T>( &mut self, request: &SpatialQueryRequest, f: T )where T: FnMut(&[SpatialQueryHit]) + 'message,

Registers a request into this EntityMessageDispatcher and puts the outgoing message into the global queue.

source

pub fn spatial_query<T>( &mut self, queue: &mut EntityMessageQueue, request: &SpatialQueryRequest, f: T )where T: FnMut(&[SpatialQueryHit]) + 'message,

Registers a request into this EntityMessageDispatcher and puts the outgoing message into a queue of your choice.

source

pub fn animation_in_global_queue<T>(&mut self, request: &AnimationRequest, f: T)where T: FnMut(&AnimationReplyType) + 'message,

Registers an animation into this EntityMessageDispatcher and puts the outgoing message into the global queue.

source

pub fn animation<T>( &mut self, queue: &mut EntityMessageQueue, request: &AnimationRequest, f: T )where T: FnMut(&AnimationReplyType) + 'message,

Registers an animation into this EntityMessageDispatcher and puts the outgoing message into a queue of your choice.

source

pub fn on_collision<T>(&mut self, entity: Entity, f: T)where T: FnMut(&[OnCollision]) + 'message,

Registers a callback for listening on collisions

source

pub fn on_trigger<T>(&mut self, entity: Entity, f: T)where T: FnMut(&[OnTrigger]) + 'message,

Registers a callback for listening on triggers

source

pub fn update(&mut self)

This needs to be executed to process replies and invoke closures.

The function is responsible for polling EntityMessenger to see if any reply, corresponding to the requests that have been performed on this EntityMessageDispatcher, is received.

source

pub fn global() -> &'static mut Self

Get the global EntityMessageDispatcher.

Trait Implementations§

source§

impl<'message> Default for EntityMessageDispatcher<'message>

source§

fn default() -> EntityMessageDispatcher<'message>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'message> !RefUnwindSafe for EntityMessageDispatcher<'message>

§

impl<'message> !Send for EntityMessageDispatcher<'message>

§

impl<'message> !Sync for EntityMessageDispatcher<'message>

§

impl<'message> Unpin for EntityMessageDispatcher<'message>

§

impl<'message> !UnwindSafe for EntityMessageDispatcher<'message>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.