pub struct StateHashTable<K: Key, V: Value> { /* private fields */ }Expand description
StateHashTable is the main collection.
Implementations§
Source§impl<K: Key, V: Value> StateHashTable<K, V>
impl<K: Key, V: Value> StateHashTable<K, V>
Sourcepub fn arbitary_key(&self) -> Option<K>
pub fn arbitary_key(&self) -> Option<K>
Return a seemingly-arbitrary key from the hash table or None if there’s no keys in the hash table. This is meant to be used for draining a server of waiters.
Sourcepub fn create_state<'a: 'b, 'b>(&'a self, key: K) -> Option<Handle<'a, K, V>>where
V: From<K>,
pub fn create_state<'a: 'b, 'b>(&'a self, key: K) -> Option<Handle<'a, K, V>>where
V: From<K>,
Create a new piece of state, returning None iff there already exists state for key.
Sourcepub fn get_state<'a: 'b, 'b>(&'a self, key: K) -> Option<Handle<'b, K, V>>
pub fn get_state<'a: 'b, 'b>(&'a self, key: K) -> Option<Handle<'b, K, V>>
Return an existing new piece of state, returning None iff there does not exist state for
key.
Sourcepub fn get_or_create_state<'a: 'b, 'b>(&'a self, key: K) -> Handle<'b, K, V>where
V: From<K>,
pub fn get_or_create_state<'a: 'b, 'b>(&'a self, key: K) -> Handle<'b, K, V>where
V: From<K>,
Return an existing piece of state, or create a new one, and always return a handle to the
state for key.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> !Freeze for StateHashTable<K, V>
impl<K, V> RefUnwindSafe for StateHashTable<K, V>
impl<K, V> Send for StateHashTable<K, V>
impl<K, V> Sync for StateHashTable<K, V>
impl<K, V> Unpin for StateHashTable<K, V>where
K: Unpin,
impl<K, V> UnwindSafe for StateHashTable<K, V>
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