pub struct SignalerSync { /* private fields */ }
Implementations§
Source§impl SignalerSync
impl SignalerSync
pub fn new() -> SignalerSync
pub fn stop(&mut self)
Sourcepub fn subscribe(
&self,
signal: &str,
f: Box<dyn Fn(Signal) + 'static>,
) -> Result<u32, Error>
pub fn subscribe( &self, signal: &str, f: Box<dyn Fn(Signal) + 'static>, ) -> Result<u32, Error>
subscribe a callback to a signal
This callback will be called with all signals that starts with the
signal
string, for example, if you subscribe a callback to the signal
“custom-signal”, this callback will have the following behaviour:
signal | f is called —————————––+———–– “custom-signal” | true “custom-signal2” | true “custom-signal-with more text” | true “custom” | false “custom-signa” | false “other signal” | false
This method returns the callback id that can be used to unsubscribe
Sourcepub fn unsubscribe(&self, id: u32)
pub fn unsubscribe(&self, id: u32)
Unsubscribe a callback by id. Use the id returned in the subscribe method to remove this signal
pub fn clear_signal(&self, signal: &str)
pub fn signal_loop_sync(&self) -> bool
Trait Implementations§
Source§impl Clone for SignalerSync
impl Clone for SignalerSync
Source§fn clone(&self) -> SignalerSync
fn clone(&self) -> SignalerSync
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SignalerSync
impl Debug for SignalerSync
Auto Trait Implementations§
impl Freeze for SignalerSync
impl RefUnwindSafe for SignalerSync
impl !Send for SignalerSync
impl !Sync for SignalerSync
impl Unpin for SignalerSync
impl UnwindSafe for SignalerSync
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more