pub struct UnaryGroup<K, T, S = RandomState> { /* private fields */ }Expand description
UnaryGroup represents a class of work and creates a space in which units of work can be executed with duplicate suppression.
Implementations§
Source§impl<K, T, S> UnaryGroup<K, T, S>where
S: Default,
impl<K, T, S> UnaryGroup<K, T, S>where
S: Default,
Sourcepub fn new() -> UnaryGroup<K, T, S>
pub fn new() -> UnaryGroup<K, T, S>
Create a new Group to do work with.
Source§impl<K, T, S> UnaryGroup<K, T, S>
impl<K, T, S> UnaryGroup<K, T, S>
Sourcepub async fn work<Q, F>(&self, key: &Q, fut: F) -> T
pub async fn work<Q, F>(&self, key: &Q, fut: F) -> T
Execute and return the value for a given function, making sure that only one operation is in-flight at a given moment.
- If a duplicate call comes in, that caller will wait until the original call completes and return the same value.
Sourcepub async fn work_no_retry<Q, F>(&self, key: &Q, fut: F) -> Option<T>
pub async fn work_no_retry<Q, F>(&self, key: &Q, fut: F) -> Option<T>
Execute and return the value for a given function, making sure that only one operation is in-flight at a given moment.
- If a duplicate call comes in, that caller will wait until the original call completes and return the same value.
- If the leader drops, the call will return
None.
Trait Implementations§
Source§impl<K, T, S> Debug for UnaryGroup<K, T, S>
impl<K, T, S> Debug for UnaryGroup<K, T, S>
Auto Trait Implementations§
impl<K, T, S = RandomState> !Freeze for UnaryGroup<K, T, S>
impl<K, T, S = RandomState> !RefUnwindSafe for UnaryGroup<K, T, S>
impl<K, T, S> Send for UnaryGroup<K, T, S>
impl<K, T, S> Sync for UnaryGroup<K, T, S>
impl<K, T, S> Unpin for UnaryGroup<K, T, S>
impl<K, T, S> UnwindSafe for UnaryGroup<K, T, S>where
K: UnwindSafe,
S: UnwindSafe,
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