From 2da57fa97aa87c73faf210015a5a86d36c6dd387 Mon Sep 17 00:00:00 2001 From: jabu Date: Mon, 6 Mar 2023 23:04:14 -0600 Subject: [PATCH] no-op workaround 5732 on non-wasm builds --- src/workaround_5732.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/workaround_5732.rs b/src/workaround_5732.rs index 92b91b3..eaaa315 100644 --- a/src/workaround_5732.rs +++ b/src/workaround_5732.rs @@ -6,9 +6,12 @@ use std::sync::{Mutex, Once}; use bevy::prelude::*; +#[cfg(target_arch = "wasm32")] static mut HANDLES: MaybeUninit>> = MaybeUninit::uninit(); +#[cfg(target_arch = "wasm32")] static ONCE: Once = Once::new(); +#[cfg(target_arch = "wasm32")] pub(crate) fn store(handle: HandleUntyped) { let handles = unsafe { ONCE.call_once(|| { @@ -20,3 +23,6 @@ pub(crate) fn store(handle: HandleUntyped) { let mut guard = handles.lock().expect("expected to lock mutex"); guard.insert(handle); } + +#[cfg(not(target_arch = "wasm32"))] +pub(crate) fn store(_handle: HandleUntyped) {}