Trait frappe::Signal [] [src]

pub trait Signal<T>: Clone + 'static {
    fn sample(&self) -> T;
    fn sample_with<F, R>(&self, cb: F) -> R
    where
        F: FnOnce(Cow<T>) -> R
; fn map<F, R>(&self, f: F) -> SignalFn<R>
    where
        F: Fn(Cow<T>) -> R + 'static,
        R: Clone,
        T: Clone + 'static
, { ... } fn snapshot<S, F, R>(&self, trigger: &Stream<S>, f: F) -> Stream<R>
    where
        F: Fn(Cow<T>, Cow<S>) -> R + 'static,
        S: Clone + 'static,
        R: Clone + 'static,
        T: Clone + 'static
, { ... } fn switch<U>(&self) -> SignalNested<U>
    where
        T: Signal<U> + Into<SignalAny<U>>,
        U: Clone
, { ... } }

Represents a continuous value that changes over time.

Required Methods

Sample by value.

This will clone the content of the signal.

Sample by reference.

This is meant to be the most efficient way when cloning is undesirable, but it requires a callback to prevent outliving internal RwLock borrows.

Provided Methods

Maps a signal with the provided function.

Samples the value of this signal every time the trigger stream fires.

Creates a new signal that samples the inner value of a nested signal.

Implementors