ravenous-tools/weaponry/examples/usage_scenario.rs

31 lines
1.4 KiB
Rust

// Workspace: weaponry
// File: examples/usage_scenario.rs
//! Test use case of a scenario
//!
//!
// TODO : All of these should likely be in the prelude if used like this
use weaponry::interfaces::{Reportable, Scenario};
use weaponry::weaponry_structs::CrossRecipeScenario;
use weaponry::weaponry_structs::equipement_scenario::ConfigMock;
// use weaponry::interfaces::
fn main() {
let s = CrossRecipeScenario::new_with_config(ConfigMock {}).unwrap();
let re = s.generate_refined_recipes().unwrap();
println!("{}", re.get_report(Some("Refined List")));
}
// // Load DB
// let db = EquipementDatabase::new("./databases/weapons.db").unwrap();
// // Do a first deserialisation
// let initial_deserialisation = db.serialize_vec_from_table::<DatabaseEquipementStats>("Equipements", None).unwrap();
// // Follow up by parsing this deserialisation by a transformation into the right intermediate representation
// let intermediate_deserialisation = initial_deserialisation.into_iter().map(InnerEquipementStats::try_from).collect::<Vec<_>>();
// // // Inspect the sucesses/filures
// // let f = intermediate_deserialisation.iter().fold((0, 0), |val, res| (val.0 + res.is_ok() as usize, val.1 + 1_usize));
// // println!("Succeded in parsing {}/{}", f.0, f.1);
// // println!("Final data {:#?}", intermediate_deserialisation);
// // println!("Failed to parse: {:#?}", intermediate_deserialisation.into_iter().filter_map(|v| v.err()).collect::<Vec<_>>());