use super::mt_data::MortData;
use once_cell::sync::Lazy;
use rustc_hash::FxHashMap;
const ELT15_F_XML: &str = include_str!("../../data/elt15_f.xml");
const ELT15_M_XML: &str = include_str!("../../data/elt15_m.xml");
pub static BUILTIN_MORT_DATA: Lazy<FxHashMap<&'static str, MortData>> = Lazy::new(|| {
let mut map = FxHashMap::default();
for id in ["AM92", "AF92", "PFA92", "PMA92"] {
match MortData::from_ifoa_url_id(id) {
Ok(data) => {
map.insert(id, data);
}
Err(e) => panic!("Failed to preload builtin table {id}: {e}"),
}
}
for id in ["PFA92C10", "PMA92C10", "PFA92C20", "PMA92C20"] {
match MortData::from_ifoa_custom(id) {
Ok(data) => {
map.insert(id, data);
}
Err(e) => panic!("Failed to preload builtin table {id}: {e}"),
}
}
for (key, xml_str) in [("ELT15_F", ELT15_F_XML), ("ELT15_M", ELT15_M_XML)] {
match MortData::from_soa_xml_string(xml_str) {
Ok(data) => {
map.insert(key, data);
}
Err(e) => panic!("Failed to preload builtin table {key}: {e}"),
}
}
for id in ["SULT"] {
match MortData::from_soa_custom(id) {
Ok(data) => {
map.insert(id, data);
}
Err(e) => panic!("Failed to preload builtin table {id}: {e}"),
}
}
map
});