Struct SignalerSync

Source
pub struct SignalerSync { /* private fields */ }

Implementations§

Source§

impl SignalerSync

Source

pub fn new() -> SignalerSync

Source

pub fn stop(&mut self)

Source

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

Source

pub fn unsubscribe(&self, id: u32)

Unsubscribe a callback by id. Use the id returned in the subscribe method to remove this signal

Source

pub fn clear_signal(&self, signal: &str)

Source

pub fn signal_loop_sync(&self) -> bool

Trait Implementations§

Source§

impl Clone for SignalerSync

Source§

fn clone(&self) -> SignalerSync

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SignalerSync

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Signaler for SignalerSync

Source§

fn base<'a>(&'a self) -> &'a SigBase

Source§

fn emit(&self, t: SigType, signal: &str) -> Result<(), Error>

emit a signal that trigger all callbacks subscribed to this signal

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.