noodling
This commit is contained in:
parent
e3ddd88271
commit
3bce71dd37
1 changed files with 13 additions and 2 deletions
15
src/main.rs
15
src/main.rs
|
@ -7,8 +7,19 @@ use serde::Deserialize;
|
|||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let path = env::args_os().nth(1).ok_or("i NEED a path")?;
|
||||
let file = File::open(path)?;
|
||||
let data: Stats = serde_json::from_reader(file)?;
|
||||
println!("{data:#?}");
|
||||
let stats: Stats = serde_json::from_reader(file)?;
|
||||
eprintln!("{:#?}", stats.info);
|
||||
|
||||
let mut mons: Vec<_> = stats
|
||||
.data
|
||||
.iter()
|
||||
.filter(|(_k, v)| v.usage > 0.01)
|
||||
.map(|(k, v)| (k, v.viability_ceiling[1] as f32 / v.usage))
|
||||
.collect();
|
||||
mons.sort_unstable_by(|(_, v1), (_, v2)| v1.total_cmp(v2).reverse());
|
||||
|
||||
println!("{:#?}", &mons[..10]);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue