Skip to main content

Module events

Module events 

Source
Expand description

Typed, bounded event queues for gameplay code.

These queues are ordinary owned data: keep them in host-owned systems or in an individual script. They do not register global resources and are not a cross-library message bus. Events are consumed explicitly, never by the clock.

use kvas_engine::events::EventQueue;
let mut events = EventQueue::new(2);
assert!(events.push("door opened").is_ok());
assert_eq!(events.drain().collect::<Vec<_>>(), vec!["door opened"]);
assert!(events.is_empty());

Structsยง

EventQueue
FIFO queue with an explicit capacity limit and no silent event loss.