[][src]Struct valerie::state::StateGeneric

pub struct StateGeneric<T, D> { /* fields omitted */ }

A generic State type

You can make your own type of State Variable using this.

Implementations

impl<T, D> StateGeneric<T, D>[src]

pub fn new(
    value: D,
    reader: fn(_: &T) -> D,
    writer: fn(_: &T, _: D),
    new: fn(_: D) -> T
) -> Self
[src]

To make a new Generic State type.

Description

  • value - The data to store
  • reader - The reader function which reads the function
  • writer - The writer function
  • new - To make enclose the value, eg: Mutex::new

impl<T, D> StateGeneric<T, D> where
    T: 'static,
    D: Display + Clone + 'static, 
[src]

pub fn from<U, F>(
    state: &U,
    func: F,
    reader: fn(_: &T) -> D,
    writer: fn(_: &T, _: D),
    new: fn(_: D) -> T
) -> Self where
    U: StateTrait + 'static,
    F: FnMut(U::Value) -> Self::Value + 'static, 
[src]

A from function to derive the value from other state variables.

Trait Implementations

impl<T, D> Clone for StateGeneric<T, D>[src]

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

impl<T, D> Eq for StateGeneric<T, D>[src]

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

impl<T, D> PartialEq<StateGeneric<T, D>> for StateGeneric<T, D>[src]

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

type Value = D

Type that is stored in the State variable.

type Store = T

Type that is wrapped in Arc which stores the value.

type Channel = Channel

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

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

Auto Trait Implementations

impl<T, D> !RefUnwindSafe for StateGeneric<T, D>

impl<T, D> Send for StateGeneric<T, D> where
    T: Send + Sync

impl<T, D> Sync for StateGeneric<T, D> where
    T: Send + Sync

impl<T, D> Unpin for StateGeneric<T, D>

impl<T, D> !UnwindSafe for StateGeneric<T, D>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.