Migrate from lazy_static to once_cell
This commit is contained in:
parent
4c39b3188c
commit
2c01e9e747
18 changed files with 477 additions and 519 deletions
|
|
@ -5,15 +5,14 @@ use std::{
|
|||
os::raw::*,
|
||||
};
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use super::*;
|
||||
|
||||
type AtomCache = HashMap<CString, ffi::Atom>;
|
||||
|
||||
lazy_static! {
|
||||
static ref ATOM_CACHE: Mutex<AtomCache> = Mutex::new(HashMap::with_capacity(2048));
|
||||
}
|
||||
static ATOM_CACHE: Lazy<Mutex<AtomCache>> = Lazy::new(|| Mutex::new(HashMap::with_capacity(2048)));
|
||||
|
||||
impl XConnection {
|
||||
pub fn get_atom<T: AsRef<CStr> + Debug>(&self, name: T) -> ffi::Atom {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue