Struct singleflight::Group
source · pub struct Group<T>{ /* private fields */ }
Expand description
Group represents a class of work and creates a space in which units of work can be executed with duplicate suppression.
Implementations§
source§impl<T> Group<T>
impl<T> Group<T>
sourcepub fn work<F>(&self, key: &str, func: F) -> Twhere
F: Fn() -> T,
pub fn work<F>(&self, key: &str, func: F) -> Twhere
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> !Freeze for Group<T>
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>where
T: 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