Change fn new to accept a file instead of a BufWriter/BufReader

Change the function new for the BDFWriter and BDFReader to accept a File instead of a BufWriter or BufReader since it's boilerplate code
master
Trivernis 5 years ago
parent 78484ed656
commit cc485d9566

@ -269,12 +269,13 @@ fn decrypt_with_dictionary_file(
chunk_count = meta.chunk_count; chunk_count = meta.chunk_count;
} }
let mut pb = ProgressBar::new(chunk_count as u64); let mut pb = ProgressBar::new(chunk_count as u64);
let (rx, tx) = sync_channel::<Vec<DataEntry>>(100); let (rx, tx) = sync_channel::<Vec<DataEntry>>(1000);
let _handle = thread::spawn(move || { let _handle = thread::spawn(move || {
let mut lookup_table = HashLookupTable::new(HashMap::new()); let mut lookup_table = HashLookupTable::new(HashMap::new());
if let Ok(table) = bdf_file.read_lookup_table() { if let Ok(table) = bdf_file.read_lookup_table() {
lookup_table = table.clone(); lookup_table = table.clone();
} }
/// TODO extract data entries in separate threads
while let Ok(next_chunk) = &mut bdf_file.next_chunk() { while let Ok(next_chunk) = &mut bdf_file.next_chunk() {
if let Ok(entries) = next_chunk.data_entries(&lookup_table) { if let Ok(entries) = next_chunk.data_entries(&lookup_table) {
if let Err(_) = rx.send(entries) {} if let Err(_) = rx.send(entries) {}

Loading…
Cancel
Save