Struct eventador::AsyncSubscriber[][src]

pub struct AsyncSubscriber<'a, T> { /* fields omitted */ }

A handle to subscribe to events and receive them asynchronously.

Implements the [Stream] trait to offer subscribed events from the event-bus as an asynchronous stream.

Example

Basic usage:

let eventbus = Eventador::new(4)?;

let subscriber = eventbus.async_subscriber::<usize>();
let mut publisher: AsyncPublisher<usize> = eventbus.async_publisher();

let mut i: usize = 1234;
publisher.send(i).await?;

let mut msg = subscriber.recv().await.unwrap();
assert_eq!(i, *msg);

Implementations

impl<'a, T> AsyncSubscriber<'a, T> where
    T: Send
[src]

pub fn sequence(&self) -> u64[src]

Get the current internal sequence number for the AsyncSubscriber.

This sequence number signifies what events the Subscriber may have already read, and any events with a sequence value higher than this are events that are still unread.

Trait Implementations

impl<'a, T: 'static> Stream for AsyncSubscriber<'a, T>[src]

type Item = EventRead<'a, T>

Values yielded by the stream.

Auto Trait Implementations

impl<'a, T> !RefUnwindSafe for AsyncSubscriber<'a, T>[src]

impl<'a, T> Send for AsyncSubscriber<'a, T> where
    T: Sync
[src]

impl<'a, T> Sync for AsyncSubscriber<'a, T> where
    T: Sync
[src]

impl<'a, T> Unpin for AsyncSubscriber<'a, T>[src]

impl<'a, T> !UnwindSafe for AsyncSubscriber<'a, T>[src]

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> Pointable for T

type Init = T

The type for initializers.

impl<T> StreamExt for T where
    T: Stream + ?Sized

impl<T> StreamExt for T where
    T: Stream + ?Sized
[src]

impl<S> StreamExt for S where
    S: Stream + ?Sized

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.