Struct trex::EventQueue [] [src]

pub struct EventQueue<T> {
    // some fields omitted
}

Allows for emitting events and iterating over them in the order that they were emitted. Events are immutable and queues are not flushed until the end of the frame, so multiple clients can receive events from the same queue.

Examples

let mut queue = trex::EventQueue::<&str>::new();
queue.emit("Hello!");
assert_eq!(queue.receive().next(), Some(&"Hello!"));

Methods

impl<T> EventQueue<T>
[src]

fn new() -> EventQueue<T>

Create a new, empty EventQueue.

fn emit(&mut self, event: T)

Emit a new event to the queue.

fn receive(&self) -> Iter<T>

Iterate over all events in the queue.

fn flush(&mut self)

Clear all events from the queue.