Skip to main content

Set

Trait Set 

Source
pub trait Set {
    type Value;

    // Required methods
    fn set(&self, value: Self::Value);
    fn try_set(&self, value: Self::Value) -> Option<Self::Value>;
}
Expand description

Updates the value of the signal by replacing it.

Required Associated Types§

Source

type Value

The type of the value contained in the signal.

Required Methods§

Source

fn set(&self, value: Self::Value)

Updates the value by replacing it, and notifies subscribers that it has changed.

Source

fn try_set(&self, value: Self::Value) -> Option<Self::Value>

Updates the value by replacing it, and notifies subscribers that it has changed.

If the signal has already been disposed, returns Some(value) with the value that was passed in. Otherwise, returns None.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, S> Set for SignalSetter<T, S>
where T: 'static, S: Storage<ArcWriteSignal<T>> + Storage<Box<dyn Fn(T) + Send + Sync>>,

Source§

type Value = T

Source§

impl<T> Set for T
where T: Update + IsDisposed,

Source§

type Value = <T as Update>::Value