shadow_rs::utility

Module callback_queue

source
Expand description

An event/listener framework to allow listeners to subscribe to event sources.

To prevent recursive events (events which trigger new events) from leading to two listeners attempting to mutate the same state simultaneously, an event queue is used to defer new events until the current event has finished running.

Structsยง

  • A queue of events (functions/closures) which when run can add their own events to the queue. This allows events to be deferred and run later.
  • Emits events to subscribed listeners.
  • A handle is used to stop listening for events. The listener will receive events until the handle is dropped, or stop_listening() is called.