move the creation of the LIBRARIES IndexMap out of the generated file
- only leave the filling of the map in the generated code
This commit is contained in:
@@ -119,7 +119,17 @@ fn current_dir() -> PathBuf {
|
||||
}
|
||||
|
||||
mod libraries {
|
||||
include!(concat!(env!("OUT_DIR"), "/libraries.rs"));
|
||||
use indexmap::IndexMap;
|
||||
|
||||
std::thread_local! {
|
||||
static LIBRARIES: IndexMap<&'static str, &'static str> = {
|
||||
let mut m = IndexMap::new();
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/libraries.rs"));
|
||||
|
||||
m
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn contains(name: &str) -> bool {
|
||||
LIBRARIES.with(|libs| libs.contains_key(name))
|
||||
@@ -128,16 +138,6 @@ mod libraries {
|
||||
pub(crate) fn get(name: &str) -> Option<&'static str> {
|
||||
LIBRARIES.with(|libs| libs.get(name).copied())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
std::thread_local! {
|
||||
#[allow(dead_code)]
|
||||
static LIBRARIES2 : IndexMap<&'static str, &'static str> = {
|
||||
let mut m = IndexMap::new();
|
||||
m.insert("test", "test2");
|
||||
m
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub static BREAK_FROM_DISPATCH_LOOP_LOC: usize = 0;
|
||||
|
||||
Reference in New Issue
Block a user