SignalUpdate

Trait SignalUpdate 

Source
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 update(&self, f: impl FnOnce(&mut T))
       where T: 'static { ... }
}

Required Methods§

Source

fn id(&self) -> Id

get the Signal Id

Source

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§

Source

fn set(&self, new_value: T)
where T: 'static,

Sets the new_value to the Signal and triggers effect run

Source

fn update(&self, f: impl FnOnce(&mut T))
where T: 'static,

Update the stored value with the given function and triggers effect run

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<T> SignalUpdate<T> for RwSignal<T, UnsyncStorage>

Source§

impl<T> SignalUpdate<T> for WriteSignal<T, UnsyncStorage>

Source§

impl<T, O, GF, UF> SignalUpdate<O> for DerivedRwSignal<T, O, GF, UF>
where T: 'static, O: 'static, GF: Fn(&T) -> O + Copy + 'static, UF: Fn(&O) -> T + Copy + 'static,

Source§

impl<T, O, GF, UF> SignalUpdate<O> for SyncDerivedRwSignal<T, O, GF, UF>
where T: Send + Sync + 'static, O: Send + Sync + 'static, GF: Fn(&T) -> O + Copy + Send + Sync, UF: Fn(&O) -> T + Copy + Send + Sync,

Source§

impl<T: 'static> SignalUpdate<T> for BaseSignal<T>

Source§

impl<T: Send + Sync + 'static> SignalUpdate<T> for SyncBaseSignal<T>

Source§

impl<T: Send + Sync> SignalUpdate<T> for RwSignal<T, SyncStorage>

Source§

impl<T: Send + Sync> SignalUpdate<T> for WriteSignal<T, SyncStorage>