Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace once_cell crate with std::sync::OnceLock in a generated code
Browse files Browse the repository at this point in the history
andy128k committed Jan 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 33cf4d2 commit 700ed9b
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
@@ -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::OnceCell<{0}ffi::GQuark> = ::std::sync::OnceCell::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,
)?;

0 comments on commit 700ed9b

Please sign in to comment.