pub trait BatchProcessor: Sync {
type Input: Sync;
type Output: Send;
type Error: Send;
// Required method
fn process(&self, input: &Self::Input) -> Result<Self::Output, Self::Error>;
}Available on crate features
worker-batch or worker-pool or worker only.Expand description
Trait for parallel-safe message processing.
Implement this with a struct that holds only & references to immutable
dependencies. The process method must be pure – no mutable state, no I/O,
no .await. Safe for rayon par_iter().
The struct is typically created per-batch in the event loop (borrows released before the sequential phase begins). The borrow checker enforces this.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".