pub fn parallel_fasta_init<Ri, E, R, Er, Di, D, Ed, Si, S, Es, W, F, Out>(
n_threads: u32,
queue_len: usize,
reader_init: Ri,
record_data_init: Di,
rset_data_init: Si,
work: W,
func: F,
) -> Result<Option<Out>, E>where
R: Read,
Ri: Send + FnOnce() -> Result<Reader<R>, Er>,
Er: Send,
Ed: Send,
E: From<Error> + From<Er> + From<Ed> + From<Es>,
Di: Fn() -> Result<D, Ed> + Send + Sync,
D: Send,
Si: Fn() -> Result<S, Es> + Send + Sync,
S: Send,
W: Send + Sync + Fn(RefRecord<'_>, &mut D, &mut S),
F: FnMut(RefRecord<'_>, &mut D, &mut S) -> Option<Out>,
Expand description
More customisable function doing per-record processing with closures for initialization and moer options.
The reader is lazily initialized in a closure (reader_init
) and therefore does not
need to implement Send
. There is also an initializer for the output data
for each record, therefore the type is not required to implement.
Default
(record_data_init
). Finally, each record set can have
its own data (kind of thread local data, but actually passed around
with the record set) (rset_data_init
).