Skip to main content

ReadValue

Trait ReadValue 

Source
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§

Source

type Value: Deref

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

Required Methods§

Source

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

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

Provided Methods§

Source

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§

Source§

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

Source§

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