Enum carbide_core::state::state::CommonState[][src]

pub enum CommonState<T, GS> where
    T: Serialize + Clone + Debug,
    GS: GlobalState
{ LocalState { id: String, value: T, }, Value { value: T, }, GlobalState { function: fn(state: &GS) -> T, function_mut: Option<fn(state: &mut GS) -> T>, latest_value: T, }, }

Variants

LocalState

Fields of LocalState

id: Stringvalue: T
Value

Fields of Value

value: T
GlobalState

Fields of GlobalState

function: fn(state: &GS) -> Tfunction_mut: Option<fn(state: &mut GS) -> T>latest_value: T

Implementations

impl<T: Serialize + Clone + Debug, U: GlobalState> CommonState<T, U>[src]

pub fn get_value_mut(&mut self, global_state: &mut U) -> &mut T[src]

pub fn get_value(&mut self, global_state: &U) -> &T[src]

pub fn get_latest_value(&self) -> &T[src]

pub fn get_latest_value_mut(&mut self) -> &mut T[src]

pub fn get_key(&self) -> Option<&String>[src]

impl<T: Clone + Debug + Serialize + 'static, S: GlobalState> CommonState<T, S>[src]

pub fn new(val: &T) -> Self[src]

pub fn new_local(key: &str, val: &T) -> Self[src]

pub fn new_local_with_key(val: &T) -> Self[src]

Trait Implementations

impl<T: Clone, GS: Clone> Clone for CommonState<T, GS> where
    T: Serialize + Clone + Debug,
    GS: GlobalState
[src]

impl<T: Serialize + Clone + Debug, U: GlobalState> Debug for CommonState<T, U>[src]

impl<T: Serialize + Clone + Debug + 'static, GS: GlobalState> Into<Box<dyn State<T, GS> + 'static, Global>> for CommonState<T, GS>[src]

impl<T: GlobalState> Into<CommonState<Uuid, T>> for Uuid[src]

impl<T: Serialize + Clone + Debug, GS: GlobalState> State<T, GS> for CommonState<T, GS>[src]

Auto Trait Implementations

impl<T, GS> RefUnwindSafe for CommonState<T, GS> where
    T: RefUnwindSafe
[src]

impl<T, GS> Send for CommonState<T, GS> where
    T: Send
[src]

impl<T, GS> Sync for CommonState<T, GS> where
    T: Sync
[src]

impl<T, GS> Unpin for CommonState<T, GS> where
    T: Unpin
[src]

impl<T, GS> UnwindSafe for CommonState<T, GS> where
    T: UnwindSafe
[src]

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> DynClone for T where
    T: Clone
[src]

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

impl<T> GlobalState for T where
    T: 'static + Clone + Debug
[src]

impl<T> Instrument for T[src]

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

impl<X, T, GS> StateExt<T, GS> for X where
    X: 'static + State<T, GS>,
    T: 'static + Clone + Debug + DeserializeOwned + Serialize,
    GS: GlobalState
[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,