pub trait BatchReducer: Send + Sync + Sized + 'static {
    type Task: Send + Sync + Sized + 'static;
    type impl_trait_batch_reduce_0<'async_trait, const N: usize, F, R: 'async_trait, Fut>: Future<Output = Option<R>> + 'async_trait + Send
       where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>,
             F: FnOnce(UnboundedSlice<'async_trait, Self::Task, N>) -> Fut + Send + 'async_trait,
             Fut: Future<Output = R> + Send + 'async_trait;

    // Required method
    fn batch_reduce<'async_trait, const N: usize, F, R: 'async_trait, Fut>(
        task: Self::Task,
        f: F
    ) -> Self::impl_trait_batch_reduce_0<'async_trait, N, F, R, Fut>
       where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>,
             F: FnOnce(UnboundedSlice<'async_trait, Self::Task, N>) -> Fut + Send + 'async_trait,
             Fut: Future<Output = R> + Send + 'async_trait;
}
Expand description

Auto-batched queue whereby batches are reduced by a closure

Required Associated Types§

source

type Task: Send + Sync + Sized + 'static

source

type impl_trait_batch_reduce_0<'async_trait, const N: usize, F, R: 'async_trait, Fut>: Future<Output = Option<R>> + 'async_trait + Send where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>, F: FnOnce(UnboundedSlice<'async_trait, Self::Task, N>) -> Fut + Send + 'async_trait, Fut: Future<Output = R> + Send + 'async_trait

Required Methods§

source

fn batch_reduce<'async_trait, const N: usize, F, R: 'async_trait, Fut>( task: Self::Task, f: F ) -> Self::impl_trait_batch_reduce_0<'async_trait, N, F, R, Fut>where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>, F: FnOnce(UnboundedSlice<'async_trait, Self::Task, N>) -> Fut + Send + 'async_trait, Fut: Future<Output = R> + Send + 'async_trait,

Enqueue and auto-batch task, using reducer fn once per batch. The local_queue macro will implement batch_reduce

Implementors§