Replace lazy_static with once_cell
This commit is contained in:
parent
c7541ef7d3
commit
c19f12898d
|
@ -42,7 +42,7 @@ serialize = ["serde", "erased-serde"]
|
|||
[dependencies]
|
||||
mlua_derive = { version = "0.5", optional = true, path = "mlua_derive" }
|
||||
bstr = { version = "0.2", features = ["std"], default_features = false }
|
||||
lazy_static = { version = "1.4" }
|
||||
once_cell = { version = "1.7" }
|
||||
num-traits = { version = "0.2.14" }
|
||||
futures-core = { version = "0.3.5", optional = true }
|
||||
futures-task = { version = "0.3.5", optional = true }
|
||||
|
|
|
@ -6,13 +6,15 @@ use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
|
|||
use std::sync::{Arc, Mutex};
|
||||
use std::{mem, ptr, slice};
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
use crate::ffi;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static METATABLE_CACHE: Lazy<Mutex<HashMap<TypeId, u8>>> = Lazy::new(|| {
|
||||
// The capacity must(!) be greater than number of stored keys
|
||||
static ref METATABLE_CACHE: Mutex<HashMap<TypeId, u8>> = Mutex::new(HashMap::with_capacity(32));
|
||||
}
|
||||
Mutex::new(HashMap::with_capacity(32))
|
||||
});
|
||||
|
||||
// Checks that Lua has enough free stack space for future stack operations. On failure, this will
|
||||
// panic with an internal error message.
|
||||
|
|
Loading…
Reference in a new issue