Struct frappe::Signal [] [src]

pub struct Signal<T>(_);

Represents a discrete value that changes over time.

Signals are usually constructed by stream operations and can be read using the sample or sample_with methods. They update lazily when someone reads them.

Methods

impl<T> Signal<T>
[src]

[src]

Creates a signal with constant value.

The value is assumed to be constant, so changing it while it's stored on the signal is a logic error and will cause unexpected results.

[src]

Creates a signal that samples it's values from an external source.

The closure is meant to sample a continuous value from the real world, so the signal value is assumed to be always changing.

[src]

Checks if the signal has changed since the last time it was sampled.

[src]

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

impl<T: Clone> Signal<T>
[src]

[src]

Sample by value.

This will clone the content of the signal.

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

[src]

Maps a signal with the provided function.

The closure is called only when the parent signal changes.

[src]

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

[src]

Stores the last value sent to a channel.

When sampled, the resulting signal consumes all the current values on the channel (using non-blocking operations) and returns the last value seen.

[src]

Creates a signal that folds the values from a channel.

When sampled, the resulting signal consumes all the current values on the channel (using non-blocking operations) and folds them using the current signal value as the initial accumulator state.

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

[src]

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

Trait Implementations

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

[src]

Formats the value using the given formatter.

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

[src]

Creates a constant signal with T's default value.

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

[src]

Creates a constant signal from T.

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

[src]

Creates a constant signal from T (avoids re-wrapping the Rc).

impl<T> Clone for Signal<T>
[src]

[src]

Creates a copy of this signal that references the same value.

1.0.0
[src]

Performs copy-assignment from source. Read more

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

[src]

Samples the signal and formats the value.