pub trait BatchProcessor<In, Out = ()> {
type Intermediate;
// Required methods
fn prepare_item<'life0, 'async_trait>(
&'life0 self,
input: In,
) -> Pin<Box<dyn Future<Output = Result<Self::Intermediate>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn process_batch<'life0, 'async_trait>(
&'life0 self,
mid: Vec<Self::Intermediate>,
) -> Pin<Box<dyn Future<Output = Result<Out>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Required Associated Types§
type Intermediate
Required Methods§
Sourcefn prepare_item<'life0, 'async_trait>(
&'life0 self,
input: In,
) -> Pin<Box<dyn Future<Output = Result<Self::Intermediate>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prepare_item<'life0, 'async_trait>(
&'life0 self,
input: In,
) -> Pin<Box<dyn Future<Output = Result<Self::Intermediate>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Action that does not have a special way of batching, and the caller can simply executed in parallel on many items at once.
Sourcefn process_batch<'life0, 'async_trait>(
&'life0 self,
mid: Vec<Self::Intermediate>,
) -> Pin<Box<dyn Future<Output = Result<Out>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process_batch<'life0, 'async_trait>(
&'life0 self,
mid: Vec<Self::Intermediate>,
) -> Pin<Box<dyn Future<Output = Result<Out>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Action that does have a special way of batching, and this particular type can define the batching approach.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".