do not consume iterator

This commit is contained in:
Alon Levy 2023-12-31 00:20:56 +02:00
parent 9b2f8d9377
commit ade93550ad

View File

@ -145,11 +145,14 @@ impl Iterator for Decoder {
}
pub fn decode_raw(filename: &str, frames_root: &str) -> anyhow::Result<Vec<Vec<u16>>> {
let packiter = PacketsIterator::new(filename)?;
let data = packiter.collect::<Vec<_>>();
// let (i, size) = (packiter.i, packiter.size);
let mut packiter = PacketsIterator::new(filename)?;
let mut data = vec![];
while let Some(p) = packiter.next() {
data.push(p);
}
let (i, size) = (packiter.i, packiter.size);
//println!("found {} packets, saved {}, {} size", i, data.len(), size);
println!("found {} packets, saved {}, {} size", i, data.len(), size);
let dump_filename = format!("{}/dump.bin", filename);
let mut dump = File::create_new(dump_filename);
let mut frames = vec![];