Skip to content

Commit

Permalink
Replace once_cell crate with std::sync::OnceLock in a generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
andy128k committed Jan 27, 2024
1 parent e7f0724 commit 40204b1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/codegen/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,11 @@ impl FromGlib<{sys_crate_name}::{ffi_name}> for {name} {{
ErrorDomain::Quark(quark) => {
writeln!(
w,
" static QUARK: once_cell::sync::Lazy<{0}ffi::GQuark> = once_cell::sync::Lazy::new(|| unsafe {{
" static QUARK: ::std::sync::OnceLock<{0}ffi::GQuark> = ::std::sync::OnceLock::new();
let quark = *QUARK.get_or_init(|| unsafe {{
{0}ffi::g_quark_from_static_string(b\"{1}\\0\".as_ptr() as *const _)
}});
unsafe {{ from_glib(*QUARK) }}",
unsafe {{ from_glib(quark) }}",
use_glib_if_needed(env, ""),
quark,
)?;
Expand Down

0 comments on commit 40204b1

Please sign in to comment.