pub trait ReducerExt: 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>: Future<Output = Option<R>> + 'async_trait + Send
       where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>,
             F: for<'a> FnOnce(UnboundedRange<'a, Self::Task, N>) -> Pin<Box<dyn Future<Output = R> + Send + 'a>> + Send + 'async_trait;
    type impl_trait_batch_collect_0<'async_trait, const N: usize>: Future<Output = Option<Vec<Self::Task>>> + 'async_trait + Send
       where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>;

    // Required methods
    fn batch_reduce<'async_trait, const N: usize, F, R: 'async_trait>(
        task: Self::Task,
        f: F
    ) -> Self::impl_trait_batch_reduce_0<'async_trait, N, F, R>
       where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>,
             F: for<'a> FnOnce(UnboundedRange<'a, Self::Task, N>) -> Pin<Box<dyn Future<Output = R> + Send + 'a>> + Send + 'async_trait;
    fn batch_collect<'async_trait, const N: usize>(
        task: Self::Task
    ) -> Self::impl_trait_batch_collect_0<'async_trait, N>
       where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>;
}
Expand description

Extension trait for types that impl BatchReducer

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>: Future<Output = Option<R>> + 'async_trait + Send where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>, F: for<'a> FnOnce(UnboundedRange<'a, Self::Task, N>) -> Pin<Box<dyn Future<Output = R> + Send + 'a>> + Send + 'async_trait

source

type impl_trait_batch_collect_0<'async_trait, const N: usize>: Future<Output = Option<Vec<Self::Task>>> + 'async_trait + Send where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>

Required Methods§

source

fn batch_reduce<'async_trait, const N: usize, F, R: 'async_trait>( task: Self::Task, f: F ) -> Self::impl_trait_batch_reduce_0<'async_trait, N, F, R>where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>, F: for<'a> FnOnce(UnboundedRange<'a, Self::Task, N>) -> Pin<Box<dyn Future<Output = R> + Send + 'a>> + Send + 'async_trait,

Enqueue and auto-batch task, using reducer fn once per batch

source

fn batch_collect<'async_trait, const N: usize>( task: Self::Task ) -> Self::impl_trait_batch_collect_0<'async_trait, N>where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>,

Collect into batches

Implementors§

source§

impl<T> ReducerExt for Twhere T: BatchReducer,

§

type Task = <T as BatchReducer>::Task

§

type impl_trait_batch_reduce_0<'async_trait, const N: usize, F, R: 'async_trait> where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>, F: for<'a> FnOnce(UnboundedRange<'a, Self::Task, N>) -> Pin<Box<dyn Future<Output = R> + Send + 'a>> + Send + 'async_trait, T: 'async_trait = impl Future<Output = Option<R>> + Send + 'async_trait

§

type impl_trait_batch_collect_0<'async_trait, const N: usize> where Self: LocalQueue<N, BufferCell = BufferCell<Self::Task>>, T: 'async_trait = impl Future<Output = Option<Vec<<T as ReducerExt>::Task, Global>>> + Send + 'async_trait