fix saving being slow

This commit is contained in:
mat 2022-05-08 19:00:51 -05:00
parent d9795a593a
commit a3e26b38bd

View file

@ -1,5 +1,5 @@
use lazy_static::lazy_static;
use std::collections::HashMap;
use std::{collections::HashMap, fs::File};
// use tokio::fs::File;
@ -29,8 +29,13 @@ use std::collections::HashMap;
// The code above is kept in case I come up with a better solution
lazy_static! {
pub static ref STORAGE: HashMap<String, String> =
serde_json::from_str(include_str!("en_us.json")).unwrap();
pub static ref STORAGE: HashMap<String, String> = serde_json::from_str({
let mut file = File::open("en_us.json").unwrap();
let mut contents = String::new();
file.read_to_string(&mut contents).unwrap();
contents
})
.unwrap();
}
pub fn get(key: &str) -> Option<&str> {