pub trait ParallelReader {
// Required methods
fn process_parallel<P: ParallelProcessor + Clone + 'static>(
self,
processor: P,
num_threads: usize,
) -> Result<()>;
fn process_parallel_range<P: ParallelProcessor + Clone + 'static>(
self,
processor: P,
num_threads: usize,
range: Range<usize>,
) -> Result<()>;
}
Expand description
Trait for BINSEQ readers that can process records in parallel
This is implemented by the reader not by the processor.
For the processor, see the ParallelProcessor
trait.
Required Methods§
fn process_parallel<P: ParallelProcessor + Clone + 'static>( self, processor: P, num_threads: usize, ) -> Result<()>
Sourcefn process_parallel_range<P: ParallelProcessor + Clone + 'static>(
self,
processor: P,
num_threads: usize,
range: Range<usize>,
) -> Result<()>
fn process_parallel_range<P: ParallelProcessor + Clone + 'static>( self, processor: P, num_threads: usize, range: Range<usize>, ) -> Result<()>
Process records in parallel within a specified range
This method allows parallel processing of a subset of records within the file, defined by a start and end index. The range is distributed across the specified number of threads.
§Arguments
processor
- The processor to use for each recordnum_threads
- The number of threads to spawnrange
- The range of record indices to process
§Returns
Ok(())
- If all records were processed successfullyErr(Error)
- If an error occurred during processing
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl ParallelReader for BinseqReader
impl ParallelReader for binseq::bq::MmapReader
Parallel processing implementation for memory-mapped readers