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.
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.
with_untracked
fn with_untracked<R>(self: &Self, f: impl FnOnce(&T) -> R) -> R
Calls f with the value without recording the read.
get
fn get(self: &Self) -> T
where T: Clone
A copy of the value; the read is recorded.
get_untracked
fn get_untracked(self: &Self) -> T
where T: Clone
A copy of the value; the read is not recorded.
set
fn set(self: &Self, value: T)
Replaces the value, and runs what reads it.
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.
update
fn update(self: &Self, f: impl FnOnce(&mut T) -> ())
Changes the value in place, and runs what reads it.
take
fn take(self: &Self) -> T
where T: Default
Takes the value, leaving the default, and runs what reads it.
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.
is_alive
fn is_alive(self: &Self) -> bool
Whether the owner of the signal is still alive.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeIntoValue<T>IntoValue<Option<T>>FromValue<T>FromValue<Option<T>>IntoProp<T, Value>AnyValueEqBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedPropertyValueAnyValueClassDefaultsErasedDestructorIntoEitherTreeModelIntoProp<T, FromSignal<V>>CloneCopyPartialEqDebug
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.