[−][src]Function seq_io::parallel::read_process_recordsets_init
pub fn read_process_recordsets_init<R, Ri, Ei, W, F, O, Out>(
reader_init: Ri,
n_workers: u32,
queue_len: usize,
work: W,
func: F
) -> Result<Out, Ei> where
R: RecordSetReader,
Ri: Send + FnOnce() -> Result<R, Ei>,
R::RecordSet: Default + Send,
O: Default + Send,
W: Send + Sync + Fn(&mut R::RecordSet, &mut O),
F: FnOnce(ParallelDataSets<R::RecordSet, R::Err, O>) -> Out,
Ei: Send,
Like read_process_recordsets
, but additionally
allows initiating the reader in the background thread using a closure
(reader_init
).
This is useful for readers, which don't implement Send
.
The reader_init
closure has to return a result. Errors are returned from
the main function witout being mixed with reading errors. This may lead to
nested Result
being returned if the func
closure returns Result
.