diff --git a/dessin/Cargo.toml b/dessin/Cargo.toml index b3c7d67..f9e03ac 100644 --- a/dessin/Cargo.toml +++ b/dessin/Cargo.toml @@ -21,7 +21,6 @@ dessin-macros = { path = "../dessin-macros", version = "0.8.19-pre" } fontdue = "^0.8.0" image = "^0.24.8" nalgebra = "^0.32.3" -once_cell = "^1.19.0" # palette = "^0.7.2" [dev-dependencies] diff --git a/dessin/src/shapes/text/font.rs b/dessin/src/shapes/text/font.rs index 256478b..9c86093 100644 --- a/dessin/src/shapes/text/font.rs +++ b/dessin/src/shapes/text/font.rs @@ -1,22 +1,19 @@ use super::FontWeight; -use once_cell::sync::OnceCell; -use std::{ - collections::HashMap, - sync::{Arc, RwLock}, -}; +use std::sync::OnceLock; +use std::{collections::HashMap, sync::RwLock}; -static FONT_HOLDER: OnceCell>> = OnceCell::new(); +static FONT_HOLDER: OnceLock> = OnceLock::new(); fn font_holder T>(f: F) -> T { f(&FONT_HOLDER - .get_or_init(|| Arc::new(RwLock::new(FontHolder::new()))) + .get_or_init(|| RwLock::new(FontHolder::new())) .read() .unwrap()) } fn font_holder_mut T>(f: F) -> T { f(&mut FONT_HOLDER - .get_or_init(|| Arc::new(RwLock::new(FontHolder::new()))) + .get_or_init(|| RwLock::new(FontHolder::new())) // RwLock is needed to have a mutable case .write() .unwrap()) }