EmitHandle

Struct EmitHandle 

Source
pub struct EmitHandle<Args, R = (), C = DefaultCombiner, G = i32>
where Args: Clone + 'static, R: 'static, C: Combiner<R> + 'static, G: Ord + Send + Sync + 'static,
{ /* private fields */ }
Expand description

A handle to a signal that allows the signal to be emitted. Useful in cases where it is undesireable to allow unresitriced access to a signal while still allowing the signal to be emitted. Internally, an EmitHandle uses a WeakSignal. The result of calling emit on an EmitHandle is an Option<C::Output> where C is the combiner type of the signal. If the underlying signal no longer exists, None is returned.

§Example

use signals2::*;
 
let sig: Signal<(), i32> = Signal::new();
let emit_handle = sig.get_emit_handle();
sig.connect(|| 1);
assert_eq!(emit_handle.emit(), Some(Some(1)));

std::mem::drop(sig);
assert_eq!(emit_handle.emit(), None);

Trait Implementations§

Source§

impl<R, C, G> Emit0<R, C> for EmitHandle<(), R, C, G>
where (): Clone, C: Combiner<R> + 'static, G: Ord + Send + Sync,

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit(&self) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.
Source§

impl<R, C, G, T0> Emit1<R, C, T0> for EmitHandle<(T0,), R, C, G>
where (T0,): Clone, C: Combiner<R> + 'static, G: Ord + Send + Sync,

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit(&self, a: T0) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.
Source§

impl<R, C, G, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> Emit10<R, C, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> for EmitHandle<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9), R, C, G>

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit( &self, a: T0, b: T1, c: T2, d: T3, e: T4, f: T5, g: T6, h: T7, i: T8, j: T9, ) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.
Source§

impl<R, C, G, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Emit11<R, C, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> for EmitHandle<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10), R, C, G>

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit( &self, a: T0, b: T1, c: T2, d: T3, e: T4, f: T5, g: T6, h: T7, i: T8, j: T9, k: T10, ) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.
Source§

impl<R, C, G, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Emit12<R, C, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> for EmitHandle<(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11), R, C, G>

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit( &self, a: T0, b: T1, c: T2, d: T3, e: T4, f: T5, g: T6, h: T7, i: T8, j: T9, k: T10, l: T11, ) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.
Source§

impl<R, C, G, T0, T1> Emit2<R, C, T0, T1> for EmitHandle<(T0, T1), R, C, G>
where (T0, T1): Clone, C: Combiner<R> + 'static, G: Ord + Send + Sync,

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit(&self, a: T0, b: T1) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.
Source§

impl<R, C, G, T0, T1, T2> Emit3<R, C, T0, T1, T2> for EmitHandle<(T0, T1, T2), R, C, G>
where (T0, T1, T2): Clone, C: Combiner<R> + 'static, G: Ord + Send + Sync,

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit(&self, a: T0, b: T1, c: T2) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.
Source§

impl<R, C, G, T0, T1, T2, T3> Emit4<R, C, T0, T1, T2, T3> for EmitHandle<(T0, T1, T2, T3), R, C, G>
where (T0, T1, T2, T3): Clone, C: Combiner<R> + 'static, G: Ord + Send + Sync,

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit(&self, a: T0, b: T1, c: T2, d: T3) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.
Source§

impl<R, C, G, T0, T1, T2, T3, T4> Emit5<R, C, T0, T1, T2, T3, T4> for EmitHandle<(T0, T1, T2, T3, T4), R, C, G>
where (T0, T1, T2, T3, T4): Clone, C: Combiner<R> + 'static, G: Ord + Send + Sync,

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit(&self, a: T0, b: T1, c: T2, d: T3, e: T4) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.
Source§

impl<R, C, G, T0, T1, T2, T3, T4, T5> Emit6<R, C, T0, T1, T2, T3, T4, T5> for EmitHandle<(T0, T1, T2, T3, T4, T5), R, C, G>
where (T0, T1, T2, T3, T4, T5): Clone, C: Combiner<R> + 'static, G: Ord + Send + Sync,

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit(&self, a: T0, b: T1, c: T2, d: T3, e: T4, f: T5) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.
Source§

impl<R, C, G, T0, T1, T2, T3, T4, T5, T6> Emit7<R, C, T0, T1, T2, T3, T4, T5, T6> for EmitHandle<(T0, T1, T2, T3, T4, T5, T6), R, C, G>
where (T0, T1, T2, T3, T4, T5, T6): Clone, C: Combiner<R> + 'static, G: Ord + Send + Sync,

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit( &self, a: T0, b: T1, c: T2, d: T3, e: T4, f: T5, g: T6, ) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.
Source§

impl<R, C, G, T0, T1, T2, T3, T4, T5, T6, T7> Emit8<R, C, T0, T1, T2, T3, T4, T5, T6, T7> for EmitHandle<(T0, T1, T2, T3, T4, T5, T6, T7), R, C, G>
where (T0, T1, T2, T3, T4, T5, T6, T7): Clone, C: Combiner<R> + 'static, G: Ord + Send + Sync,

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit( &self, a: T0, b: T1, c: T2, d: T3, e: T4, f: T5, g: T6, h: T7, ) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.
Source§

impl<R, C, G, T0, T1, T2, T3, T4, T5, T6, T7, T8> Emit9<R, C, T0, T1, T2, T3, T4, T5, T6, T7, T8> for EmitHandle<(T0, T1, T2, T3, T4, T5, T6, T7, T8), R, C, G>

Source§

type Output = Option<<C as Combiner<R>>::Output>

The return value of emit will be C::Output for Signals and Option<C::Output> for EmitHandles
Source§

fn emit( &self, a: T0, b: T1, c: T2, d: T3, e: T4, f: T5, g: T6, h: T7, i: T8, ) -> Option<C::Output>

Executes the signal’s underlying slots, passing clones of the given arguments to the slot functions.

Auto Trait Implementations§

§

impl<Args, R, C, G> Freeze for EmitHandle<Args, R, C, G>

§

impl<Args, R, C, G> RefUnwindSafe for EmitHandle<Args, R, C, G>

§

impl<Args, R, C, G> Send for EmitHandle<Args, R, C, G>

§

impl<Args, R, C, G> Sync for EmitHandle<Args, R, C, G>

§

impl<Args, R, C, G> Unpin for EmitHandle<Args, R, C, G>

§

impl<Args, R, C, G> UnwindSafe for EmitHandle<Args, R, C, G>

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> 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, 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.