SignalExt

Trait SignalExt 

Source
pub trait SignalExt: Signal + Sized {
    // Provided methods
    fn map<F, Output>(self, f: F) -> Map<Self, F, Output>
       where F: 'static + Clone + Fn(Self::Output) -> Output,
             Output: 'static,
             Self: 'static { ... }
    fn zip<B: Signal>(self, b: B) -> Zip<Self, B>
       where Self::Output: Clone,
             B::Output: Clone { ... }
    fn computed(self) -> Computed<Self::Output>
       where Self: Clone + 'static { ... }
    fn with<T>(self, metadata: T) -> WithMetadata<Self, T> { ... }
    fn animated(self) -> impl Signal<Output = Self::Output> { ... }
}
Expand description

Extension trait providing additional methods for Signal types.

This trait adds convenient methods for transforming, combining, and working with reactive computations in a fluent interface style.

Provided Methods§

Source

fn map<F, Output>(self, f: F) -> Map<Self, F, Output>
where F: 'static + Clone + Fn(Self::Output) -> Output, Output: 'static, Self: 'static,

Transforms the output of this computation using the provided function.

§Arguments
  • f - A function that transforms the output value.
§Returns

A new computation that applies the transformation.

Source

fn zip<B: Signal>(self, b: B) -> Zip<Self, B>
where Self::Output: Clone, B::Output: Clone,

Combines this computation with another computation.

§Arguments
  • b - Another computation to combine with this one.
§Returns

A new computation that produces a tuple of both values.

Source

fn computed(self) -> Computed<Self::Output>
where Self: Clone + 'static,

Converts this computation into a Computed wrapper.

This allows the computation to be cloned efficiently.

§Returns

A new Computed wrapper around this computation.

Source

fn with<T>(self, metadata: T) -> WithMetadata<Self, T>

Attaches metadata to this computation.

§Arguments
  • metadata - The metadata to attach.
§Returns

A new computation with the attached metadata.

Source

fn animated(self) -> impl Signal<Output = Self::Output>

Marks this computation for animation with default settings.

§Returns

A new computation that will be animated when the value changes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<C: Signal + Sized> SignalExt for C