Subscription

Trait Subscription 

Source
pub trait Subscription
where Self: PartialEq,
{ type Event: Message; // Required methods fn subscribed_to(&self, message: &Self::Event) -> bool; fn discriminant_set(&self) -> &[<Self::Event as Message>::Discriminant]; fn send_event( &self, message: Self::Event, ) -> Result<(), SendError<Self::Event>>; }
Expand description

A trait describin a bus subscription

Required Associated Types§

Required Methods§

Source

fn subscribed_to(&self, message: &Self::Event) -> bool

Test whether this subscriiption is subscribed to a message

Source

fn discriminant_set(&self) -> &[<Self::Event as Message>::Discriminant]

Returns a slice of discriminants corresponding to messages this subsccription is subscribed to

Source

fn send_event(&self, message: Self::Event) -> Result<(), SendError<Self::Event>>

Delivers a message to this subscription’s reciever

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<M> Subscription for Subscriber<M>
where M: Message + Debug,

Source§

type Event = M