[−][src]Struct valerie::state::StateAtomic
State variable to be used with types that implement Copy
This uses AtomicCell
of crossbeam internally.
Implementations
impl<T> StateAtomic<T>
[src]
impl<T> StateAtomic<T> where
T: Display + Copy + 'static,
[src]
T: Display + Copy + 'static,
pub fn from<U, F>(state: &U, func: F) -> Self where
U: StateTrait + 'static,
F: FnMut(U::Value) -> Self::Value + 'static,
[src]
U: StateTrait + 'static,
F: FnMut(U::Value) -> Self::Value + 'static,
Derive a StateAtomic
variable from another variable implementing StateTrait
.
Examples
let counter = StateAtomic::new(1); let double_counter = StateAtomic::from(&counter, |x| x * 2); div!( h3!("Single count ", counter), h3!("Double count ", double_counter) )
Trait Implementations
impl<T, U> Add<U> for StateAtomic<T> where
T: Display + Copy + Add<U> + AddAssign<U>,
[src]
T: Display + Copy + Add<U> + AddAssign<U>,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: U) -> Self::Output
[src]
impl<T, U> AddAssign<U> for StateAtomic<T> where
T: Display + Copy + AddAssign<U>,
[src]
T: Display + Copy + AddAssign<U>,
fn add_assign(&mut self, other: U)
[src]
impl<T> Clone for StateAtomic<T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Component for StateAtomic<T> where
T: Display + Copy,
[src]
T: Display + Copy,
impl<T, U> Div<U> for StateAtomic<T> where
T: Display + Copy + Div<U> + DivAssign<U>,
[src]
T: Display + Copy + Div<U> + DivAssign<U>,
type Output = Self
The resulting type after applying the /
operator.
fn div(self, other: U) -> Self::Output
[src]
impl<T, U> DivAssign<U> for StateAtomic<T> where
T: Display + Copy + DivAssign<U>,
[src]
T: Display + Copy + DivAssign<U>,
fn div_assign(&mut self, other: U)
[src]
impl<T> Eq for StateAtomic<T>
[src]
impl<T> From<StateAtomic<T>> for Node where
T: Display + Copy,
[src]
T: Display + Copy,
fn from(x: StateAtomic<T>) -> Self
[src]
impl<T, U> Mul<U> for StateAtomic<T> where
T: Display + Copy + Mul<U> + MulAssign<U>,
[src]
T: Display + Copy + Mul<U> + MulAssign<U>,
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, other: U) -> Self::Output
[src]
impl<T, U> MulAssign<U> for StateAtomic<T> where
T: Display + Copy + MulAssign<U>,
[src]
T: Display + Copy + MulAssign<U>,
fn mul_assign(&mut self, other: U)
[src]
impl<T> PartialEq<StateAtomic<T>> for StateAtomic<T>
[src]
impl<T, U> Rem<U> for StateAtomic<T> where
T: Display + Copy + Rem<U> + RemAssign<U>,
[src]
T: Display + Copy + Rem<U> + RemAssign<U>,
type Output = Self
The resulting type after applying the %
operator.
fn rem(self, other: U) -> Self::Output
[src]
impl<T, U> RemAssign<U> for StateAtomic<T> where
T: Display + Copy + RemAssign<U>,
[src]
T: Display + Copy + RemAssign<U>,
fn rem_assign(&mut self, other: U)
[src]
impl<T> StateTrait for StateAtomic<T> where
T: Display + Copy,
[src]
T: Display + Copy,
type Value = T
Type that is stored in the State variable.
type Store = AtomicCell<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, U> Sub<U> for StateAtomic<T> where
T: Display + Copy + Sub<U> + SubAssign<U>,
[src]
T: Display + Copy + Sub<U> + SubAssign<U>,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: U) -> Self::Output
[src]
impl<T, U> SubAssign<U> for StateAtomic<T> where
T: Display + Copy + SubAssign<U>,
[src]
T: Display + Copy + SubAssign<U>,
fn sub_assign(&mut self, other: U)
[src]
impl<T> Value for StateAtomic<T> where
T: Copy + Display,
[src]
T: Copy + Display,
Auto Trait Implementations
impl<T> !RefUnwindSafe for StateAtomic<T>
impl<T> Send for StateAtomic<T> where
T: Send,
T: Send,
impl<T> Sync for StateAtomic<T> where
T: Send,
T: Send,
impl<T> Unpin for StateAtomic<T>
impl<T> !UnwindSafe for StateAtomic<T>
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>,