Struct singleflight::Group
source · [−]Expand description
Group represents a class of work and creates a space in which units of work can be executed with duplicate suppression.
Implementations
sourceimpl<T> Group<T> where
T: Clone + Debug,
impl<T> Group<T> where
T: Clone + Debug,
sourcepub fn work<F>(&self, key: &str, func: F) -> T where
F: Fn() -> T,
pub fn work<F>(&self, key: &str, func: F) -> T where
F: Fn() -> 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.
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for Group<T>
impl<T> Send for Group<T> where
T: Send,
impl<T> Sync for Group<T> where
T: Send,
impl<T> Unpin for Group<T>
impl<T> !UnwindSafe for Group<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more