Trait SignalUpdate
pub trait SignalUpdate<T> {
// Required methods
fn id(&self) -> Id;
fn try_update<O>(&self, f: impl FnOnce(&mut T) -> O) -> Option<O>
where T: 'static;
// Provided methods
fn set(&self, new_value: T)
where T: 'static { ... }
fn set_if_changed(&self, new_value: T)
where T: PartialEq + 'static { ... }
fn update(&self, f: impl FnOnce(&mut T))
where T: 'static { ... }
}Required Methods§
fn id(&self) -> Id
fn id(&self) -> Id
get the Signal Id
fn try_update<O>(&self, f: impl FnOnce(&mut T) -> O) -> Option<O>where
T: 'static,
fn try_update<O>(&self, f: impl FnOnce(&mut T) -> O) -> Option<O>where
T: 'static,
Update the stored value with the given function, triggers effect run, and returns the value returned by the function
Provided Methods§
fn set(&self, new_value: T)where
T: 'static,
fn set(&self, new_value: T)where
T: 'static,
Sets the new_value to the Signal and triggers effect run
fn set_if_changed(&self, new_value: T)where
T: PartialEq + 'static,
fn set_if_changed(&self, new_value: T)where
T: PartialEq + 'static,
Sets the new_value to the Signal and triggers effect run only if the value has changed
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.