Struct shrev::EventChannel
[−]
[src]
pub struct EventChannel<E> { /* fields omitted */ }
Event channel
Methods
impl<E> EventChannel<E> where
E: Event,
[src]
E: Event,
fn new() -> Self
[src]
Create a new EventChannel with a default size of 200
fn with_capacity(size: usize) -> Self
[src]
Create a new EventChannel 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 channel wouldn't know where in the ringbuffer the reader has read to earlier. This information is stored in the reader id.
fn slice_write(&mut self, events: &[E]) -> Result<(), EventError> where
E: Clone,
[src]
E: Clone,
Write a slice of events into storage
fn drain_vec_write(&mut self, events: &mut Vec<E>) -> Result<(), EventError>
[src]
Drain a vector of events into storage.
fn single_write(&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.
fn lossy_read(
&self,
reader_id: &mut ReaderId
) -> Result<EventIterator<E>, EventError>
[src]
&self,
reader_id: &mut ReaderId
) -> Result<EventIterator<E>, EventError>
Read events with loss if there is Overflow
. Will only print an error message, and return
what could be salvaged.