1
0
Fork 0
forked from wry/wry

all: remove once_cell dependency

This commit is contained in:
Julian Orth 2026-03-30 12:30:26 +02:00
parent c50242562a
commit 41ef632a15
10 changed files with 34 additions and 32 deletions

View file

@ -35,7 +35,7 @@ macro_rules! dynload {
)*
}
pub static $item: once_cell::sync::Lazy<Option<$container>> = once_cell::sync::Lazy::new(|| unsafe {
pub static $item: std::sync::LazyLock<Option<$container>> = std::sync::LazyLock::new(|| unsafe {
use crate::utils::errorfmt::ErrorFmt;
let lib = match libloading::Library::new($name) {
Ok(l) => l,
@ -94,8 +94,13 @@ use {
},
},
isnt::std_1::vec::IsntVecExt,
once_cell::sync::Lazy,
std::{any::Any, cell::RefCell, error::Error, rc::Rc, sync::Arc},
std::{
any::Any,
cell::RefCell,
error::Error,
rc::Rc,
sync::{Arc, LazyLock},
},
thiserror::Error,
};
@ -109,7 +114,8 @@ pub mod sys {
pub use super::{egl::sys::*, gl::sys::*};
}
static INIT: Lazy<Result<(), Arc<RenderError>>> = Lazy::new(|| egl::init().map_err(Arc::new));
static INIT: LazyLock<Result<(), Arc<RenderError>>> =
LazyLock::new(|| egl::init().map_err(Arc::new));
pub(super) fn create_gfx_context(
drm: &Drm,

View file

@ -12,8 +12,7 @@ use {
},
bstr::ByteSlice,
log::Level,
once_cell::sync::Lazy,
std::ffi::CStr,
std::{ffi::CStr, sync::LazyLock},
sys::{
EGL_BAD_ACCESS, EGL_BAD_ALLOC, EGL_BAD_ATTRIBUTE, EGL_BAD_CONFIG, EGL_BAD_CONTEXT,
EGL_BAD_CURRENT_SURFACE, EGL_BAD_DEVICE_EXT, EGL_BAD_DISPLAY, EGL_BAD_MATCH,
@ -28,9 +27,9 @@ pub mod display;
pub mod image;
pub mod sys;
pub(crate) static PROCS: Lazy<Option<ExtProc>> = Lazy::new(ExtProc::load);
pub(crate) static PROCS: LazyLock<Option<ExtProc>> = LazyLock::new(ExtProc::load);
pub(crate) static EXTS: Lazy<ClientExt> = Lazy::new(get_client_ext);
pub(crate) static EXTS: LazyLock<ClientExt> = LazyLock::new(get_client_ext);
pub(in crate::gfx_apis::gl) fn init() -> Result<(), RenderError> {
let Some(egl) = EGL.as_ref() else {