Trait SignalWith

Source
pub trait SignalWith<T> {
    // Required method
    fn id(&self) -> Id;

    // Provided methods
    fn with<O>(&self, f: impl FnOnce(&T) -> O) -> O
       where T: 'static { ... }
    fn with_untracked<O>(&self, f: impl FnOnce(&T) -> O) -> O
       where T: 'static { ... }
    fn try_with<O>(&self, f: impl FnOnce(Option<&T>) -> O) -> O
       where T: 'static { ... }
    fn try_with_untracked<O>(&self, f: impl FnOnce(Option<&T>) -> O) -> O
       where T: 'static { ... }
}

Required Methods§

Source

fn id(&self) -> Id

get the Signal Id

Provided Methods§

Source

fn with<O>(&self, f: impl FnOnce(&T) -> O) -> O
where T: 'static,

Applies a closure to the current value stored in the Signal, and subscribes to the current running effect to this Memo.

Source

fn with_untracked<O>(&self, f: impl FnOnce(&T) -> O) -> O
where T: 'static,

Applies a closure to the current value stored in the Signal, but it doesn’t subscribe to the current running effect.

Source

fn try_with<O>(&self, f: impl FnOnce(Option<&T>) -> O) -> O
where T: 'static,

If the signal isn’t disposed, applies a closure to the current value stored in the Signal. It subscribes to the current running effect.

Source

fn try_with_untracked<O>(&self, f: impl FnOnce(Option<&T>) -> O) -> O
where T: 'static,

If the signal isn’t disposed, applies a closure to the current value stored in the Signal, but it doesn’t subscribe to the current running effect.

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> SignalWith<T> for BaseSignal<T>

Source§

impl<T> SignalWith<T> for Memo<T>

Source§

impl<T> SignalWith<T> for ReadSignal<T>

Source§

impl<T> SignalWith<T> for RwSignal<T>

Source§

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