[−][src]Struct valerie::state::StateGeneric
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]
value: D,
reader: fn(_: &T) -> D,
writer: fn(_: &T, _: D),
new: fn(_: D) -> T
) -> Self
To make a new Generic State type.
Description
value
- The data to storereader
- The reader function which reads the functionwriter
- The writer functionnew
- To make enclose thevalue
, eg: Mutex::new
impl<T, D> StateGeneric<T, D> where
T: 'static,
D: Display + Clone + 'static,
[src]
T: 'static,
D: Display + Clone + 'static,
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]
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,
A from function to derive the value from other state variables.
Trait Implementations
impl<T, D> Clone for StateGeneric<T, D>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T, D> Component for StateGeneric<T, D> where
D: Display + Clone,
[src]
D: Display + Clone,
impl<T, D> Eq for StateGeneric<T, D>
[src]
impl<T, D> From<StateGeneric<T, D>> for Node where
D: Display + Clone,
[src]
D: Display + Clone,
fn from(x: StateGeneric<T, D>) -> Self
[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]
D: Display + Clone,
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.
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> Value for StateGeneric<T, D> where
D: Clone + Display,
[src]
D: Clone + Display,
Auto Trait Implementations
impl<T, D> !RefUnwindSafe for StateGeneric<T, D>
impl<T, D> Send for StateGeneric<T, D> where
T: Send + Sync,
T: Send + Sync,
impl<T, D> Sync for StateGeneric<T, D> where
T: Send + Sync,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,