[][src]Struct event_feed::Reader

pub struct Reader<Evt> where
    Evt: Send
{ /* fields omitted */ }

Recieves events from event feeds and queues them until they are processed.

Implementations

impl<Evt> Reader<Evt> where
    Evt: Send
[src]

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]

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]

impl<'r, Evt> IntoIterator for &'r Reader<Evt> where
    Evt: Send
[src]

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

impl<Evt> UnwindSafe for Reader<Evt> where
    Evt: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.