Trait GetValue

pub trait GetValue: DefinedAt {
    type Value: Clone;

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

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

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

Required Associated Types§

type Value: Clone

The type of the value contained in the value.

Required Methods§

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

Clones and returns the value of the value, non-reactively, or None if the value has already been disposed.

Provided Methods§

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

Clones and returns the value of the value, non-reactively.

§Panics

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

Implementors§

§

impl<T> GetValue for T
where T: WithValue, <T as WithValue>::Value: Clone,

§

type Value = <T as WithValue>::Value