[][src]Trait valerie::state::StateTrait

pub trait StateTrait: Clone + Component + Eq {
    type Value: Clone + Display;
    type Store;
    type Channel: Clone;
    fn value(&self) -> Self::Value;
fn tx(&self) -> StateSender<Self::Channel>;
fn rx(&self) -> StateReceiver<Self::Channel>;
fn put(&self, value: Self::Value);
fn pointer(&self) -> Arc<Self::Store>;
fn update(&self); }

Trait that State types have to implement

Associated Types

type Value: Clone + Display

Type that is stored in the State variable.

type Store

Type that is wrapped in Arc which stores the value.

type Channel: Clone

Channel type is used to pass the message between the Sender and the Receiver.

Loading content...

Required methods

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

Returns a copy of the original value stored.

fn tx(&self) -> StateSender<Self::Channel>

Returns the clone of the Sender.

fn rx(&self) -> StateReceiver<Self::Channel>

Returns the clone of the Receiver.

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

Stores the value on to the State variable.

fn pointer(&self) -> Arc<Self::Store>

Gives a pointer to the value.

fn update(&self)

Update the value across the DOM. put() should call this.

Loading content...

Implementors

impl<T> StateTrait for StateAtomic<T> where
    T: Display + Copy
[src]

type Value = T

type Store = AtomicCell<T>

type Channel = Channel

impl<T> StateTrait for StateMutex<T> where
    T: Display + Clone
[src]

type Value = T

type Store = Mutex<T>

type Channel = Channel

impl<T, D> StateTrait for StateGeneric<T, D> where
    D: Display + Clone
[src]

type Value = D

type Store = T

type Channel = Channel

Loading content...