pub struct Signal<T> { /* private fields */ }
Expand description
Signal can be used to inform others that new data is available.
There is two generic ways to subscribe for new data notificaitons:
Implementations§
Source§impl<T: 'static + Clone> Signal<T>
impl<T: 'static + Clone> Signal<T>
Sourcepub fn connect_func<F: 'static + FnMut(&T)>(&mut self, f: F)
pub fn connect_func<F: 'static + FnMut(&T)>(&mut self, f: F)
Connect callback to the Signal
Sourcepub fn connect_slot(&mut self, slot: &dyn Slot<T>)
pub fn connect_slot(&mut self, slot: &dyn Slot<T>)
Connect Slot to the Signal
Sourcepub fn emit(&mut self, t: T)
pub fn emit(&mut self, t: T)
Emit signal. During the call all related callbacks will be activated and data will be pushed to Slots’ queues.
Sourcepub fn has_connections(&self) -> bool
pub fn has_connections(&self) -> bool
Shows if signal connected to any callback and/or Slot.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Signal<T>
impl<T> !RefUnwindSafe for Signal<T>
impl<T> !Send for Signal<T>
impl<T> !Sync for Signal<T>
impl<T> Unpin for Signal<T>
impl<T> !UnwindSafe for Signal<T>
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