Struct dharma::signaler::Signaler
[−]
[src]
pub struct Signaler<P> where
P: Clone + Send, { /* fields omitted */ }
Signaler
allows to send events (or notifications) to other parts of application possibly
running in different threads. Signaler
is generic over sent data type, meaning that it can
convey only data of given type (therefore easiest is to choose enum).
Methods
impl<P> Signaler<P> where
P: Clone + Send,
[src]
P: Clone + Send,
fn new() -> Self
Signaler
constructor.
fn subscribe(&mut self, id: SignalId, receiver: &Receiver<P>)
Subscribe given receiver
for a signal id
.
fn register(&mut self, receiver: &Receiver<P>)
Register receiver
for control instructions like request to terminate.
fn emit(&mut self, id: SignalId, package: P)
Emit signal id
containing data package
. All subscribed Receiver
s will be notified.
fn terminate(&mut self)
Send Terminate
instruction to registered Receiver
s indicating Signaler
(possibly whole
application) is going to shut down.
Trait Implementations
impl<P> Clone for Signaler<P> where
P: Clone + Send,
[src]
P: Clone + Send,
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more