Fix: read toml once by singleton

This commit is contained in:
itiB
2020-11-06 20:55:42 +09:00
parent a1b4d88ec1
commit edcadea9b0

View File

@@ -16,11 +16,11 @@ pub fn singleton() -> Box<SingletonReader> {
static mut SINGLETON: Option<Box<SingletonReader>> = Option::None;
static ONCE: Once = Once::new();
unsafe {
ONCE.call_once(|| {
let mut toml = toml::ParseToml::new();
&toml.read_dir("rules".to_string());
unsafe {
ONCE.call_once(|| {
let singleton = SingletonReader {
regex: read_csv("regexes.txt"),
whitelist: read_csv("whitelist.txt"),