Struct ark_api::world::EntityMessageDispatcher
source · [−]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
sourceimpl<'message> EntityMessageDispatcher<'message>
impl<'message> EntityMessageDispatcher<'message>
sourcepub fn remove_all_listeners(&mut self)
pub fn remove_all_listeners(&mut self)
Remove all listenerers
sourcepub fn spatial_query_in_global_queue<T>(
&mut self,
request: &SpatialQueryRequest,
f: T
) where
T: FnMut(&[SpatialQueryHit]) + 'message,
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.
sourcepub fn spatial_query<T>(
&mut self,
queue: &mut EntityMessageQueue,
request: &SpatialQueryRequest,
f: T
) where
T: FnMut(&[SpatialQueryHit]) + 'message,
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.
sourcepub fn animation_in_global_queue<T>(&mut self, request: &AnimationRequest, f: T) where
T: FnMut(&AnimationReplyType) + 'message,
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.
sourcepub fn animation<T>(
&mut self,
queue: &mut EntityMessageQueue,
request: &AnimationRequest,
f: T
) where
T: FnMut(&AnimationReplyType) + 'message,
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.
sourcepub fn on_collision<T>(&mut self, entity: Entity, f: T) where
T: FnMut(&[OnCollision]) + 'message,
pub fn on_collision<T>(&mut self, entity: Entity, f: T) where
T: FnMut(&[OnCollision]) + 'message,
Registers a callback for listening on collisions
sourcepub fn on_trigger<T>(&mut self, entity: Entity, f: T) where
T: FnMut(&[OnTrigger]) + 'message,
pub fn on_trigger<T>(&mut self, entity: Entity, f: T) where
T: FnMut(&[OnTrigger]) + 'message,
Registers a callback for listening on triggers
sourcepub fn update(&mut self)
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.
sourcepub fn global() -> &'static mut Self
pub fn global() -> &'static mut Self
Get the global EntityMessageDispatcher
.
Trait Implementations
sourceimpl<'message> Default for EntityMessageDispatcher<'message>
impl<'message> Default for EntityMessageDispatcher<'message>
sourcefn default() -> EntityMessageDispatcher<'message>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more