[−][src]Struct oxygengine_core::events::EventChannel
Event channel
Methods
impl<E> EventChannel<E> where
E: Event,
[src]
E: Event,
pub fn new() -> EventChannel<E>
[src]
Create a new EventChannel with a default size of 50
pub fn with_capacity(size: usize) -> EventChannel<E>
[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,
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>,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
[src]
I: IntoIterator<Item = E>,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
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>) -> StorageIterator<E>
[src]
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,
fn default() -> EventChannel<E>
[src]
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,
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Event for T where
T: Send + Sync + 'static,
[src]
T: Send + Sync + 'static,
impl<T> Erased for T
impl<T> Resource for T where
T: Any + Send + Sync,
T: Any + Send + Sync,
impl<T> TryDefault for T where
T: Default,
[src]
T: Default,
fn try_default() -> Result<T, String>
[src]
fn unwrap_default() -> Self
[src]
Calls try_default
and panics on an error case.
impl<T> Any for T where
T: Any,
T: Any,