Trait for types that can process records in parallel. This is implemented by the **processor** not by the **reader**. For the **reader**, see the [`ParallelReader`] trait.
| 207 | /// This is implemented by the **processor** not by the **reader**. |
| 208 | /// For the **reader**, see the [`ParallelReader`] trait. |
| 209 | pub trait ParallelProcessor: Send + Clone { |
| 210 | /// Process a single record |
| 211 | fn process_record<R: BinseqRecord>(&mut self, record: R) -> Result<()>; |
| 212 | |
| 213 | /// Called when a thread finishes processing its batch |
| 214 | /// Default implementation does nothing |
| 215 | #[allow(unused_variables)] |
| 216 | fn on_batch_complete(&mut self) -> Result<()> { |
| 217 | Ok(()) |
| 218 | } |
| 219 | |
| 220 | /// Called when a thread finished processing all its batches |
| 221 | /// Default implementation does nothing |
| 222 | #[allow(unused_variables)] |
| 223 | fn on_thread_complete(&mut self) -> Result<()> { |
| 224 | Ok(()) |
| 225 | } |
| 226 | |
| 227 | /// Set the thread ID for this processor |
| 228 | /// |
| 229 | /// Each thread should call this method with its own unique ID. |
| 230 | #[allow(unused_variables)] |
| 231 | fn set_tid(&mut self, _tid: usize) { |
| 232 | // Default implementation does nothing |
| 233 | } |
| 234 | |
| 235 | /// Get the thread ID for this processor |
| 236 | fn get_tid(&self) -> Option<usize> { |
| 237 | None |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | #[cfg(test)] |
| 242 | mod testing { |
no outgoing calls
no test coverage detected