FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Signal

    struct · ferroui-view · v0.5.0

    struct Signal<T: 'static>
    

    A value that the reactive closures reading it follow. Copy: a move closure takes it without a clone.

    View source

    Members

    with

    fn with<R>(self: &Self, f: impl FnOnce(&T) -> R) -> R
    

    Calls f with the value, and records the read when a memo or an effect is running.

    Source

    with_untracked

    fn with_untracked<R>(self: &Self, f: impl FnOnce(&T) -> R) -> R
    

    Calls f with the value without recording the read.

    Source

    get

    fn get(self: &Self) -> T
    where T: Clone
    

    A copy of the value; the read is recorded.

    Source

    get_untracked

    fn get_untracked(self: &Self) -> T
    where T: Clone
    

    A copy of the value; the read is not recorded.

    Source

    set

    fn set(self: &Self, value: T)
    

    Replaces the value, and runs what reads it.

    Source

    set_if_changed

    fn set_if_changed(self: &Self, value: T)
    where T: PartialEq
    

    Replaces the value when it differs from the one held; a value that is equal changes nothing and runs nothing.

    Source

    update

    fn update(self: &Self, f: impl FnOnce(&mut T) -> ())
    

    Changes the value in place, and runs what reads it.

    Source

    take

    fn take(self: &Self) -> T
    where T: Default
    

    Takes the value, leaving the default, and runs what reads it.

    Source

    two_way

    fn two_way(self: Self) -> TwoWay<T>
    

    The signal as a two-way value of a property: the property follows the signal, and a change of the property (the user typed, moved a slider) is written into the signal.

    Source

    is_alive

    fn is_alive(self: &Self) -> bool
    

    Whether the owner of the signal is still alive.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.