[][src]Struct apex::Signal

pub struct Signal<T: Send + Sync + Copy + 'static> { /* fields omitted */ }

Signal component of the Signals and Slots implementation. This uses mpsc channels provided by 'crossbeam' internally for communication between this and connected Slots

Implementations

impl<T: Send + Sync + Copy + 'static> Signal<T>[src]

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

Creates a new Signal of the Type T

Returns

  • a new Signal

pub fn add_sender(&mut self, sender: Sender<T>)[src]

Adds the given sender to the Signal's list of senders

Arguments

  • 'sender' - the channel Sender to add to the list

pub fn emit(&self, signal: T) -> Result<(), SignalError<T>>[src]

Emits the given signal to all of the connected Slots

May return a SignalError if the Signal is not connected to any Slots or an error occured when sending to any Slot. If an error occurs when sending to a Slot, all Slots will still be sent to and only the most recent error will be returned.

Arguments

  • 'signal' - The signal to be emitted

Returns

  • success - Ok(())
  • failure - SignalError

Trait Implementations

impl<T: Default + Send + Sync + Copy + 'static> 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.