Struct shrev::EventHandler
[−]
[src]
pub struct EventHandler<E> { /* fields omitted */ }
Event handler
Methods
impl<E> EventHandler<E> where
E: Event,
[src]
E: Event,
fn new() -> Self
[src]
Create a new EventHandler with a default size of 200
fn with_capacity(size: usize) -> Self
[src]
Create a new EventHandler with the given max size
fn register_reader(&self) -> ReaderId
[src]
Register a reader.
To be able to read events, a reader id is required. This is because otherwise the handler wouldn't know where in the ringbuffer the reader has read to earlier. This information is stored in the reader id.
fn write(&mut self, events: &mut Vec<E>) -> Result<(), EventError>
[src]
Write a number of events into its storage.
fn write_single(&mut self, event: E)
[src]
Write a single event into storage.
fn read(&self, reader_id: &mut ReaderId) -> Result<EventReadData<E>, EventError>
[src]
Read any events that have been written to storage since the readers last read.