[−][src]Trait valerie::state::StateTrait
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.
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.
Implementors
impl<T> StateTrait for StateAtomic<T> where
T: Display + Copy,
[src]
T: Display + Copy,
type Value = T
type Store = AtomicCell<T>
type Channel = Channel
fn value(&self) -> Self::Value
[src]
fn tx(&self) -> StateSender<Self::Channel>
[src]
fn rx(&self) -> StateReceiver<Self::Channel>
[src]
fn put(&self, value: Self::Value)
[src]
fn pointer(&self) -> Arc<Self::Store>
[src]
fn update(&self)
[src]
impl<T> StateTrait for StateMutex<T> where
T: Display + Clone,
[src]
T: Display + Clone,
type Value = T
type Store = Mutex<T>
type Channel = Channel
fn value(&self) -> Self::Value
[src]
fn tx(&self) -> StateSender<Self::Channel>
[src]
fn rx(&self) -> StateReceiver<Self::Channel>
[src]
fn put(&self, value: Self::Value)
[src]
fn pointer(&self) -> Arc<Self::Store>
[src]
fn update(&self)
[src]
impl<T, D> StateTrait for StateGeneric<T, D> where
D: Display + Clone,
[src]
D: Display + Clone,