Skip to content

Commit

Permalink
stats multiple multi
Browse files Browse the repository at this point in the history
  • Loading branch information
KG32 committed Nov 1, 2024
1 parent 6b2d8b6 commit d5e7e11
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,19 @@ impl Stats {
Ok(())
}

fn from_dir(&mut self, path: &str) -> Result<Vec<PathBuf>, Box<dyn Error>> {
fn from_dir(&mut self, path: &str) -> Result<(), Box<dyn Error>> {
let paths = Self::traverse_for_uddf(path)?;
for path in &paths {
self.from_file(&path.to_str().unwrap());
}
Ok(paths)
paths.par_iter().for_each(|path| {
let UDDFData {
dives_data,
gas_mixes,
} = self.extract_data_from_file(path.to_str().unwrap()).unwrap();
dives_data.par_iter().for_each(|dd| {
let dive = self.calc_dive_stats(&dd, &gas_mixes).unwrap();
self.update_with_dive_data(dive);
});
});
Ok(())
}

fn traverse_for_uddf(path: &str) -> Result<Vec<PathBuf>, Box<dyn Error>> {
Expand Down

0 comments on commit d5e7e11

Please sign in to comment.