Trait Read

pub trait Read: DefinedAt {
    type Value: Deref;

    // Required method
    fn try_read(&self) -> Option<Self::Value>;

    // Provided method
    fn read(&self) -> Self::Value { ... }
}
Expand description

Give read-only access to a signal’s value by reference through a guard type, and subscribes the active reactive observer (an effect or computed) to changes in its value.

Required Associated Types§

type Value: Deref

The guard type that will be returned, which can be dereferenced to the value.

Required Methods§

fn try_read(&self) -> Option<Self::Value>

Subscribes to the signal, and returns the guard, or None if the signal has already been disposed.

Provided Methods§

fn read(&self) -> Self::Value

Subscribes to the signal, and returns the guard.

§Panics

Panics if you try to access a signal that has been disposed.

Implementors§

§

impl<T> Read for T
where T: Track + ReadUntracked,

§

type Value = <T as ReadUntracked>::Value