Trait hey_listen::sync::PriorityListener [−][src]
pub trait PriorityListener<T> where
T: PartialEq + Eq + Hash + Clone + Send + Sync + 'static, { fn on_event(&self, event: &T) -> Option<PriorityDispatcherResult>; }
Every event-receiver needs to implement this trait
in order to receive dispatched events.
T
being the type you use for events, e.g. an Enum
.
Required methods
fn on_event(&self, event: &T) -> Option<PriorityDispatcherResult>
[src]
This function will be called once a listened
event-type T
has been dispatched.
If you want to mutate the listener, consider wrapping it behind an
RwLock
or Mutex
.