pub struct StateCache<K, V> { /* private fields */ }Implementations§
Source§impl<K, V> StateCache<K, V>
impl<K, V> StateCache<K, V>
Source§impl<K, V> StateCache<K, V>where
K: Hash + Eq + Clone + HeapSize,
for<'a> &'a K: IntoGroupStateKey,
V: Clone + OperatorState + HeapSize,
impl<K, V> StateCache<K, V>where
K: Hash + Eq + Clone + HeapSize,
for<'a> &'a K: IntoGroupStateKey,
V: Clone + OperatorState + HeapSize,
pub fn get(&mut self, store: &mut dyn StateStore, key: &K) -> Result<Option<V>>
pub fn set( &mut self, store: &mut dyn StateStore, key: &K, value: &V, ) -> Result<()>
pub fn put( &mut self, store: &mut dyn StateStore, key: &K, value: V, ) -> Result<()>
pub fn modify<R>(
&mut self,
store: &mut dyn StateStore,
key: &K,
f: impl FnOnce(&mut V) -> R,
) -> Result<R>where
V: Default,
pub fn remove(&mut self, store: &mut dyn StateStore, key: &K) -> Result<()>
Source§impl<K, V> StateCache<K, V>where
K: Hash + Eq + Clone + HeapSize,
for<'a> &'a K: IntoGroupStateKey,
V: Clone + Default + OperatorState + HeapSize,
impl<K, V> StateCache<K, V>where
K: Hash + Eq + Clone + HeapSize,
for<'a> &'a K: IntoGroupStateKey,
V: Clone + Default + OperatorState + HeapSize,
pub fn get_or_default( &mut self, store: &mut dyn StateStore, key: &K, ) -> Result<V>
pub fn update<U>( &mut self, store: &mut dyn StateStore, key: &K, updater: U, ) -> Result<V>
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for StateCache<K, V>
impl<K, V> RefUnwindSafe for StateCache<K, V>
impl<K, V> Send for StateCache<K, V>
impl<K, V> Sync for StateCache<K, V>
impl<K, V> Unpin for StateCache<K, V>
impl<K, V> UnsafeUnpin for StateCache<K, V>
impl<K, V> UnwindSafe for StateCache<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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more