Skip to main content

PreprocessingSource

Trait PreprocessingSource 

Source
pub trait PreprocessingSource<P: Preprocessing + 'static>: 'static + Send {
    // Required method
    fn request_n_elements_batch(
        &mut self,
        n_elements: usize,
        associated_data: <P as Preprocessing>::AssociatedData,
    ) -> NextBatch<P>;

    // Provided method
    fn request_n_elements(
        &mut self,
        n_elements: usize,
        associated_data: <P as Preprocessing>::AssociatedData,
    ) -> Vec<NextElement<P>>  { ... }
}
Expand description

Retrieves preprocessing elements for the local peer upon request.

Required Methods§

Source

fn request_n_elements_batch( &mut self, n_elements: usize, associated_data: <P as Preprocessing>::AssociatedData, ) -> NextBatch<P>

Dispatches the request synchronously and returns a lazy owned NextBatch.

&mut self is released immediately — callers may issue several batch requests before driving any of them, enabling concurrent overlap between generation and consumption.

Provided Methods§

Source

fn request_n_elements( &mut self, n_elements: usize, associated_data: <P as Preprocessing>::AssociatedData, ) -> Vec<NextElement<P>>

Decomposes the batch into a vector of per-element lazy futures.

The default implementation drives the batch into an Arc<Mutex<Vec<Option<P>>>> shared across all per-element futures. Each future takes its slot by index exactly once — no cloning of P. Cloning the shared handle is a cheap Arc pointer copy; the mutex serialises concurrent access if futures are polled from different threads.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§