pub struct Events<E: Hash + Copy + Eq + Sync + Send> { /* private fields */ }Expand description
All events produced in one frame: connections, entity lifecycle, component changes, messages, and errors.
Implementations§
Source§impl<E: Hash + Copy + Eq + Sync + Send> Events<E>
impl<E: Hash + Copy + Eq + Sync + Send> Events<E>
Sourcepub fn read<V: WorldEvent<E>>(&mut self) -> V::Iter
pub fn read<V: WorldEvent<E>>(&mut self) -> V::Iter
Drains and returns an iterator over events of type V.
Sourcepub fn has<V: WorldEvent<E>>(&self) -> bool
pub fn has<V: WorldEvent<E>>(&self) -> bool
Returns true if at least one event of type V is queued.
Sourcepub fn has_messages(&self) -> bool
pub fn has_messages(&self) -> bool
Returns true if any messages are queued; prefer read::<MessageEvent<C, M>>() in application code.
Sourcepub fn take_messages(
&mut self,
) -> HashMap<ChannelKind, HashMap<MessageKind, Vec<MessageContainer>>>
pub fn take_messages( &mut self, ) -> HashMap<ChannelKind, HashMap<MessageKind, Vec<MessageContainer>>>
Takes all queued messages, leaving the internal buffer empty; prefer read::<MessageEvent<C, M>>() in application code.
Sourcepub fn has_requests(&self) -> bool
pub fn has_requests(&self) -> bool
Returns true if any requests are queued; prefer read::<RequestEvent<C, Q>>() in application code.
Sourcepub fn take_requests(
&mut self,
) -> HashMap<ChannelKind, HashMap<MessageKind, Vec<(GlobalResponseId, MessageContainer)>>>
pub fn take_requests( &mut self, ) -> HashMap<ChannelKind, HashMap<MessageKind, Vec<(GlobalResponseId, MessageContainer)>>>
Takes all queued requests, leaving the internal buffer empty; prefer read::<RequestEvent<C, Q>>() in application code.
Sourcepub fn has_inserts(&self) -> bool
pub fn has_inserts(&self) -> bool
Returns true if any component-insert events are queued; prefer read::<InsertComponentEvent<C>>() in application code.
Sourcepub fn take_inserts(&mut self) -> Option<HashMap<ComponentKind, Vec<E>>>
pub fn take_inserts(&mut self) -> Option<HashMap<ComponentKind, Vec<E>>>
Takes all queued component-insert events; prefer read::<InsertComponentEvent<C>>() in application code.
Sourcepub fn has_updates(&self) -> bool
pub fn has_updates(&self) -> bool
Returns true if any component-update events are queued; prefer read::<UpdateComponentEvent<C>>() in application code.
Sourcepub fn take_updates(&mut self) -> Option<HashMap<ComponentKind, Vec<(Tick, E)>>>
pub fn take_updates(&mut self) -> Option<HashMap<ComponentKind, Vec<(Tick, E)>>>
Takes all queued component-update events; prefer read::<UpdateComponentEvent<C>>() in application code.
Sourcepub fn has_removes(&self) -> bool
pub fn has_removes(&self) -> bool
Returns true if any component-remove events are queued; prefer read::<RemoveComponentEvent<C>>() in application code.
Sourcepub fn take_removes(
&mut self,
) -> Option<HashMap<ComponentKind, Vec<(E, Box<dyn Replicate>)>>>
pub fn take_removes( &mut self, ) -> Option<HashMap<ComponentKind, Vec<(E, Box<dyn Replicate>)>>>
Takes all queued component-remove events; prefer read::<RemoveComponentEvent<C>>() in application code.