Fix: read toml once by singleton
This commit is contained in:
@@ -16,11 +16,11 @@ pub fn singleton() -> Box<SingletonReader> {
|
|||||||
static mut SINGLETON: Option<Box<SingletonReader>> = Option::None;
|
static mut SINGLETON: Option<Box<SingletonReader>> = Option::None;
|
||||||
static ONCE: Once = Once::new();
|
static ONCE: Once = Once::new();
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
ONCE.call_once(|| {
|
||||||
let mut toml = toml::ParseToml::new();
|
let mut toml = toml::ParseToml::new();
|
||||||
&toml.read_dir("rules".to_string());
|
&toml.read_dir("rules".to_string());
|
||||||
|
|
||||||
unsafe {
|
|
||||||
ONCE.call_once(|| {
|
|
||||||
let singleton = SingletonReader {
|
let singleton = SingletonReader {
|
||||||
regex: read_csv("regexes.txt"),
|
regex: read_csv("regexes.txt"),
|
||||||
whitelist: read_csv("whitelist.txt"),
|
whitelist: read_csv("whitelist.txt"),
|
||||||
|
|||||||
Reference in New Issue
Block a user