Trait leptos::SignalWithUntracked

source ·
pub trait SignalWithUntracked {
    type Value;

    // Required methods
    fn with_untracked<O>(&self, f: impl FnOnce(&Self::Value) -> O) -> O;
    fn try_with_untracked<O>(
        &self,
        f: impl FnOnce(&Self::Value) -> O,
    ) -> Option<O>;
}
Expand description

This trait allows getting a reference to the signals inner value without creating a dependency on the signal.

Required Associated Types§

source

type Value

The value held by the signal.

Required Methods§

source

fn with_untracked<O>(&self, f: impl FnOnce(&Self::Value) -> O) -> O

Runs the provided closure with a reference to the current value without creating a dependency on the current scope.

§Panics

Panics if you try to access a signal that is owned by a reactive node that has been disposed.

source

fn try_with_untracked<O>(&self, f: impl FnOnce(&Self::Value) -> O) -> Option<O>

Runs the provided closure with a reference to the current value without creating a dependency on the current scope. Returns [Some(O)] if the signal is still valid, None otherwise.

Object Safety§

This trait is not object safe.

Implementors§