ommui_broadcast

Trait SubscriptionRegistration

Source
pub trait SubscriptionRegistration<T: Clone> {
    // Required method
    fn subscribe_with<F: FnMut(&mut Sender<T>)>(
        &self,
        f: &mut F,
    ) -> Result<Receiver<T>, Error>;

    // Provided method
    fn subscribe(&self) -> Result<Receiver<T>, Error> { ... }
}
Expand description

A trait for subscribing to a broadcaster.

Required Methods§

Source

fn subscribe_with<F: FnMut(&mut Sender<T>)>( &self, f: &mut F, ) -> Result<Receiver<T>, Error>

Subscribe to a broadcaster and return the receiver. Calls a function on the newly created sender. If the associated broadcaster got dropped in the meantime, an error gets returned.

Provided Methods§

Source

fn subscribe(&self) -> Result<Receiver<T>, Error>

Subscribe to a broadcaster and return the receiver. If the associated broadcaster got dropped in the meantime, an error gets returned.

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.

Implementations on Foreign Types§

Source§

impl<T: Clone> SubscriptionRegistration<T> for Sender<Sender<T>>

Source§

fn subscribe_with<F: FnMut(&mut Sender<T>)>( &self, f: &mut F, ) -> Result<Receiver<T>, Error>

Implementors§