Struct shrev::EventChannel
[−]
[src]
pub struct EventChannel<E> { /* fields omitted */ }
Event channel
Methods
impl<E> EventChannel<E> where
E: Event,
[src]
E: Event,
pub fn new() -> Self
[src]
Create a new EventChannel with a default size of 50
pub fn with_capacity(size: usize) -> Self
[src]
Create a new EventChannel with the given starting capacity.
pub fn register_reader(&mut self) -> ReaderId<E>
[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.
pub fn slice_write(&mut self, events: &[E]) where
E: Clone,
[src]
E: Clone,
Deprecated
: please use iter_write
instead
Write a slice of events into storage
pub fn iter_write<I>(&mut self, iter: I) where
I: IntoIterator<Item = E>,
[src]
I: IntoIterator<Item = E>,
Write an iterator of events into storage
pub fn drain_vec_write(&mut self, events: &mut Vec<E>)
[src]
Drain a vector of events into storage.
pub fn single_write(&mut self, event: E)
[src]
Write a single event into storage.
ⓘImportant traits for StorageIterator<'a, T>pub fn read(&self, reader_id: &mut ReaderId<E>) -> EventIterator<E>
[src]
ⓘImportant traits for StorageIterator<'a, T>
Read any events that have been written to storage since the readers last read.
Trait Implementations
impl<E> Default for EventChannel<E> where
E: Event,
[src]
E: Event,
Auto Trait Implementations
impl<E> Send for EventChannel<E> where
E: Send,
E: Send,
impl<E> Sync for EventChannel<E> where
E: Sync,
E: Sync,