[][src]Struct uniui_core::Signal

pub struct Signal<T> { /* fields omitted */ }

Signal can be used to inform others that new data is available.

There is two generic ways to subscribe for new data notificaitons:

  • callback - the callback (FnMut) will be triggered every time new data value will be emitted,
  • Slot - new data will be added to the Slot's queue. The Slot have to be pulled to obtain queued data.

Implementations

impl<T: 'static + Clone> Signal<T>[src]

pub fn new() -> Signal<T>[src]

Creates new instance

pub fn connect_func<F: 'static + FnMut(&T)>(&mut self, f: F)[src]

Connect callback to the Signal

pub fn connect_slot(&mut self, slot: &dyn Slot<T>)[src]

Connect Slot to the Signal

pub fn emit(&mut self, t: T)[src]

Emit signal. During the call all related callbacks will be activated and data will be pushed to Slots' queues.

pub fn has_connections(&self) -> bool[src]

Shows if signal connected to any callback and/or Slot.

Trait Implementations

impl<T: Default> Default for Signal<T>[src]

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.