pub struct WorkSender<K, C, O> { /* private fields */ }
Expand description
A clonable handle to the work queue. When all clones of WorkSender are dropped, the queue will process all remaining requests and terminate its output stream.
Implementations§
Source§impl<K, C, O> WorkSender<K, C, O>
impl<K, C, O> WorkSender<K, C, O>
Sourcepub fn push(
&self,
key: K,
context: C,
) -> impl Future<Output = Result<O, Closed>>
pub fn push( &self, key: K, context: C, ) -> impl Future<Output = Result<O, Closed>>
Enqueue the given key to be processed by a worker, or attach to an existing request to process this key.
Sourcepub fn push_all(
&self,
entries: impl Iterator<Item = (K, C)>,
) -> impl Iterator<Item = impl Future<Output = Result<O, Closed>>>
pub fn push_all( &self, entries: impl Iterator<Item = (K, C)>, ) -> impl Iterator<Item = impl Future<Output = Result<O, Closed>>>
Enqueue all the given keys to be processed by a worker, merging them with existing known tasks if possible, returning an iterator of the futures that will resolve to the results of processing the keys.
This method is similar to, but more efficient than, mapping an iterator to
WorkSender::push
.
Trait Implementations§
Source§impl<K, C, O> Clone for WorkSender<K, C, O>
impl<K, C, O> Clone for WorkSender<K, C, O>
Auto Trait Implementations§
impl<K, C, O> Freeze for WorkSender<K, C, O>
impl<K, C, O> !RefUnwindSafe for WorkSender<K, C, O>
impl<K, C, O> Send for WorkSender<K, C, O>
impl<K, C, O> Sync for WorkSender<K, C, O>
impl<K, C, O> Unpin for WorkSender<K, C, O>
impl<K, C, O> !UnwindSafe for WorkSender<K, C, O>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)