Skip to main content

AddListener

Trait AddListener 

Source
pub trait AddListener<T> {
    // Required method
    fn add_listener(&self, f: T) -> Subscription;
}
Expand description

An extension trait for AddListener::add_listener, which we want to take a variety of function-like arguments for readability.

Required Methods§

Source

fn add_listener(&self, f: T) -> Subscription

Register a listener to this PubSub<_>, which will be automatically deregistered when the return Subscription is dropped.

§Arguments
  • f The callback, presumably a function-like type.

Implementors§

Source§

impl<T, U> AddListener<U> for PubSub<T>
where T: Clone + 'static, U: Fn(T) + 'static,

Source§

impl<T, U> AddListener<U> for Subscriber<T>
where T: Clone + 'static, U: Fn(T) + 'static,

Source§

impl<T: Clone + 'static> AddListener<Callback<T>> for PubSub<T>