leptos::reactive::prelude

Trait ReadOptional

Source
pub trait ReadOptional: DefinedAt {
    type Value;

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

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

An alternative Read trait that works with Option<Readable> types.

Required Associated Types§

Source

type Value

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

Required Methods§

Source

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§

Source

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.

Implementations on Foreign Types§

Source§

impl<T> ReadOptional for Option<T>
where Option<T>: DefinedAt, T: Read,

Implementors§