pub struct ReusableReader<P, O>(/* private fields */);
Expand description
Wrapper for parallel::Reader
instances allowing
the output to be reused in order to save allocations.
Used by parallel_fasta
/parallel_fastq
use seq_io::fastq::{Reader,Record,RecordSet};
use seq_io::parallel::{read_parallel,ReusableReader};
let inner = Reader::from_path("seqs.fastq").unwrap();
let reader = ReusableReader::new(inner);
read_parallel(reader, 4, 2, |&mut (ref record_set, ref mut out): &mut (RecordSet, Vec<bool>)| {
out.clear();
for record in record_set {
let found = record.seq().windows(3).position(|s| s == b"AAA").is_some();
out.push(found);
}
}, |record_sets| {
while let Some(result) = record_sets.next() {
let &(ref record_set, ref out) = &*result.unwrap().0;
for (record, found) in record_set.into_iter().zip(out) {
// ...
}
}
});
Implementations§
Source§impl<P, O> ReusableReader<P, O>
impl<P, O> ReusableReader<P, O>
pub fn new(p: P) -> ReusableReader<P, O>
Trait Implementations§
Auto Trait Implementations§
impl<P, O> Freeze for ReusableReader<P, O>where
P: Freeze,
impl<P, O> RefUnwindSafe for ReusableReader<P, O>where
P: RefUnwindSafe,
O: RefUnwindSafe,
impl<P, O> Send for ReusableReader<P, O>
impl<P, O> Sync for ReusableReader<P, O>
impl<P, O> Unpin for ReusableReader<P, O>
impl<P, O> UnwindSafe for ReusableReader<P, O>where
P: UnwindSafe,
O: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more