Struct eventador::Subscriber [−][src]
A handle to receive events that were subscribed to from the event-bus.
The Subscriber
will not receive intended events that were published to the event-bus
before time of subscription. It will only receive intended events that are published after the
time of subscription, as they will have a higher sequence number than the Subscriber's internal
sequence value.
Example
Basic usage:
let eventbus = Eventador::new(4)?; // subscribe first, before publishing! let subscriber = eventbus.subscribe::<usize>(); let mut i: usize = 1234; eventbus.publish(i); let mut msg = subscriber.recv(); assert_eq!(i, *msg);
Implementations
impl<T: 'static> Subscriber<T> where
T: Send,
[src]
T: Send,
pub fn sequence(&self) -> u64
[src]
Get the current internal sequence number for the Subscriber
.
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.
pub fn recv<'b>(&self) -> EventRead<'b, T>
[src]
Synchronously read an event of the correct type from the event-bus.
Example
Basic usage:
let eventbus = Eventador::new(4)?; let subscriber = eventbus.subscribe::<usize>(); let mut i: usize = 1234; eventbus.publish(i); let mut msg = subscriber.recv(); assert_eq!(i, *msg);
Auto Trait Implementations
impl<T> !RefUnwindSafe for Subscriber<T>
[src]
impl<T> Send for Subscriber<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Subscriber<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Subscriber<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> !UnwindSafe for Subscriber<T>
[src]
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,
pub 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> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
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.
pub 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>,