Skip to main content

EventChannel

Trait EventChannel 

Source
pub trait EventChannel<T>: Send + Sync
where T: Clone + Send + 'static,
{ type Receiver: EventReceiver<T>; // Required methods fn send(&self, value: T) -> Result<(), EventChannelError>; fn subscribe(&self) -> Self::Receiver; fn subscriber_count(&self) -> usize; }
Expand description

Multi-subscriber event channel.

Required Associated Types§

Source

type Receiver: EventReceiver<T>

Receiver type returned by subscribe.

Required Methods§

Source

fn send(&self, value: T) -> Result<(), EventChannelError>

Sends a value to all subscribers.

Source

fn subscribe(&self) -> Self::Receiver

Creates a new receiver.

Source

fn subscriber_count(&self) -> usize

Returns the current subscriber count.

Implementors§