pub trait EventQueue: Send + Sync {
// Required methods
fn poll(&self) -> Option<QueuedEvent>;
fn push(&self, event: QueuedEvent);
fn is_empty(&self) -> bool;
fn len(&self) -> usize;
// Provided method
fn poll_batch(&self, max: usize) -> Vec<QueuedEvent> { ... }
}Expand description
Platform-agnostic event queue trait
Implementations provide different backing stores:
MemoryEventQueue: Lock-free queue for general useTokioEventQueue: Integrates with Tokio channels (native only)
Required Methods§
Sourcefn poll(&self) -> Option<QueuedEvent>
fn poll(&self) -> Option<QueuedEvent>
Poll for the next event (non-blocking)
Returns None if the queue is empty.
Sourcefn push(&self, event: QueuedEvent)
fn push(&self, event: QueuedEvent)
Push an event onto the queue
Provided Methods§
Sourcefn poll_batch(&self, max: usize) -> Vec<QueuedEvent>
fn poll_batch(&self, max: usize) -> Vec<QueuedEvent>
Try to receive multiple events at once (batch poll)
Returns up to max events. Default implementation polls repeatedly.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".