Trait ReadValue

pub trait ReadValue: Sized + DefinedAt {
    type Value: Deref;

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

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

A variation of the Read trait that provides a signposted “always-non-reactive” API. E.g. for StoredValue.

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_value(&self) -> Option<Self::Value>

Returns the non-reactive guard, or None if the value has already been disposed.

Provided Methods§

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

Returns the non-reactive guard.

§Panics

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

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§

§

impl<T> ReadValue for ArcStoredValue<T>
where T: 'static,

§

type Value = ReadGuard<T, Plain<T>>

§

impl<T, S> ReadValue for StoredValue<T, S>
where T: 'static, S: Storage<ArcStoredValue<T>>,

§

type Value = ReadGuard<T, Plain<T>>