Trait SetValue
pub trait SetValue: DefinedAt {
type Value;
// Required method
fn try_set_value(&self, value: Self::Value) -> Option<Self::Value>;
// Provided method
fn set_value(&self, value: Self::Value) { ... }
}
Expand description
A variation of the Set
trait that provides a signposted “always-non-reactive” API.
E.g. for StoredValue
.
Required Associated Types§
type Value
type Value
The type of the value contained in the value.
Required Methods§
fn try_set_value(&self, value: Self::Value) -> Option<Self::Value>
fn try_set_value(&self, value: Self::Value) -> Option<Self::Value>
Updates the value by replacing it, non-reactively.
If the value has already been disposed, returns Some(value)
with the value that was
passed in. Otherwise, returns None
.