pub struct States<K, S> {
states: LinkedHashMap<K, StateRef<S>>,
}
Fields§
§states: LinkedHashMap<K, StateRef<S>>
Implementations§
source§impl<K, S> States<K, S>where
K: Hash + Eq,
impl<K, S> States<K, S>where K: Hash + Eq,
sourcepub fn new(key: K, state: S) -> Self
pub fn new(key: K, state: S) -> Self
create a new States with the given initial state
by default this state is always assumed confirmed
sourcepub fn contains<Q>(&self, key: &Q) -> boolwhere
K: Borrow<Q>,
Q: Hash + Eq + ?Sized,
pub fn contains<Q>(&self, key: &Q) -> boolwhere K: Borrow<Q>, Q: Hash + Eq + ?Sized,
check wether the given state associate to this key is present in the States
pub fn confirm<Q>(&mut self, key: &Q)where K: Borrow<Q>, Q: Hash + Eq + ?Sized,
fn pop_old_confirmed_states(&mut self)
source§impl<K, S> States<K, S>
impl<K, S> States<K, S>
sourcepub fn iter(&self) -> impl Iterator<Item = (&K, &StateRef<S>)>
pub fn iter(&self) -> impl Iterator<Item = (&K, &StateRef<S>)>
iterate through the states from the confirmed one up to the most recent one.
there is always at least one element in the iterator (the confirmed one).
pub fn unconfirmed_states(&self) -> impl Iterator<Item = (&K, &StateRef<S>)>
sourcepub fn confirmed_state(&self) -> &StateRef<S>
pub fn confirmed_state(&self) -> &StateRef<S>
access the confirmed state of the store verse
sourcepub fn last_state(&self) -> &StateRef<S>
pub fn last_state(&self) -> &StateRef<S>
get the last state of the store
Trait Implementations§
Auto Trait Implementations§
impl<K, S> RefUnwindSafe for States<K, S>where K: RefUnwindSafe, S: RefUnwindSafe,
impl<K, S> Send for States<K, S>where K: Send, S: Send,
impl<K, S> Sync for States<K, S>where K: Sync, S: Sync,
impl<K, S> Unpin for States<K, S>
impl<K, S> UnwindSafe for States<K, S>where K: RefUnwindSafe, S: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more