[−][src]Struct event_feed::Reader
Recieves events from event feeds and queues them until they are processed.
Implementations
impl<Evt> Reader<Evt> where
Evt: Send,
[src]
Evt: Send,
pub fn read(&self) -> ReaderIter<Evt>
[src]
Creates an iterator which reads and removes the events from the queue.
The queue's mutex remains locked for the entire lifetime of the returned iterator, which means that all calls to the feed's send_with
, send
and others will block. If you do not want that behavior, drop the iterator after a number of iterations and create a new one, which should cause a fair mutex unlock if it ran for long enough, allowing the feed to send new events.
pub fn read_with<F>(&self, f: F) where
F: FnMut(Evt),
[src]
F: FnMut(Evt),
Reads the entire queue by using the specified closure to process the events. Useful for simple event handling, i.e. if the closure doesn't return anything depending on how it processes the events. If it does, using read
directly is necesarry.
See read
for the mutex-related implications of using this.
Trait Implementations
impl<Evt> Debug for Reader<Evt> where
Evt: Debug + Send,
[src]
Evt: Debug + Send,
impl<'r, Evt> IntoIterator for &'r Reader<Evt> where
Evt: Send,
[src]
Evt: Send,
type IntoIter = ReaderIter<'r, Evt>
Which kind of iterator are we turning this into?
type Item = Evt
The type of the elements being iterated over.
fn into_iter(self) -> ReaderIter<'r, Evt>
[src]
Creates an iterator which reads and removes events from the queue.
Equivalent to self.read()
, intended to be used in for
loops.
Auto Trait Implementations
impl<Evt> !RefUnwindSafe for Reader<Evt>
impl<Evt> Send for Reader<Evt>
impl<Evt> Sync for Reader<Evt>
impl<Evt> Unpin for Reader<Evt> where
Evt: Unpin,
Evt: Unpin,
impl<Evt> UnwindSafe for Reader<Evt> where
Evt: UnwindSafe,
Evt: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,