Struct signals::Signal
[−]
[src]
pub struct Signal<I, O, F> where
F: SigFn<I, O>, { /* fields omitted */ }
Signals are the bread and butter of the crate. A signal can trigger other signals whose input is the same output as the original signal. Signals support both threaded and non-threaded children.
Methods
impl<I, O, F> Signal<I, O, F> where
F: SigFn<I, O>,
O: 'static + Send + Sync,
[src]
F: SigFn<I, O>,
O: 'static + Send + Sync,
pub fn new(f: F) -> Arc<Mutex<Signal<I, O, impl SigFn<I, O>>>> where
F: SigFn<I, O>,
O: Default,
[src]
F: SigFn<I, O>,
O: Default,
Create a thread-safe parent signal. Note that the return function is Arc<Mutex<Signal<>>>
pub fn create_listener<Q, G>(
&mut self,
f: G
) -> Arc<Mutex<Signal<O, Q, impl SigFn<O, Q>>>> where
G: 'static + SigFn<O, Q> + Send,
Q: 'static + Default + PartialEq + Send + Sync,
O: 'static,
[src]
&mut self,
f: G
) -> Arc<Mutex<Signal<O, Q, impl SigFn<O, Q>>>> where
G: 'static + SigFn<O, Q> + Send,
Q: 'static + Default + PartialEq + Send + Sync,
O: 'static,
This method is a helper for Signal::new(f) and register_listener(...)
pub fn create_threaded_listener<Q, G>(
&mut self,
f: G
) -> Arc<Mutex<Signal<O, Q, impl SigFn<O, Q>>>> where
G: 'static + SigFn<O, Q> + Send,
Q: 'static + Default + PartialEq + Send + Sync,
O: 'static,
[src]
&mut self,
f: G
) -> Arc<Mutex<Signal<O, Q, impl SigFn<O, Q>>>> where
G: 'static + SigFn<O, Q> + Send,
Q: 'static + Default + PartialEq + Send + Sync,
O: 'static,
This method is a helper for Signal::new(f) and register_threaded_listener(...)
pub fn register_listener<S>(&mut self, strong: &Arc<Mutex<S>>) where
S: 'static + Emitter<input = O>,
[src]
S: 'static + Emitter<input = O>,
Register a child listener that will execute in the same thread as Self.
pub fn register_threaded_listener<S>(&mut self, strong: &Arc<Mutex<S>>) where
S: 'static + Emitter<input = O>,
[src]
S: 'static + Emitter<input = O>,
Register a child listener that will run on its own thread.
pub fn get(&self) -> Arc<O>
[src]
Get the last result of this signal. If signal has not run, then it will return the Signal's output's default value.
Trait Implementations
impl<I, O, F> Emitter for Signal<I, O, F> where
F: SigFn<I, O> + Send,
O: 'static + PartialEq + Send + Sync,
I: Send,
[src]
F: SigFn<I, O> + Send,
O: 'static + PartialEq + Send + Sync,
I: Send,