#[doc(hidden)]
pub const LOAD_ID: bool = cfg!(any(
all(
feature = "std-load-id",
not(all(target_arch = "wasm32", target_os = "unknown"))
),
all(
feature = "web-load-id",
target_arch = "wasm32",
target_os = "unknown"
)
));
#[cfg(any(
all(
feature = "std-load-id",
not(all(target_arch = "wasm32", target_os = "unknown"))
),
all(feature = "web-load-id", target_arch = "wasm32", target_os = "unknown")
))]
mod numbered {
use core::sync::atomic::{AtomicU64, Ordering};
static LOADS: AtomicU64 = AtomicU64::new(1);
#[derive(Clone, Copy)]
pub(crate) struct Load(u64);
impl Load {
pub(crate) fn next() -> Load {
Load(LOADS.fetch_add(1, Ordering::Relaxed))
}
pub(crate) fn id(self) -> u64 {
self.0
}
}
}
#[cfg(not(any(
all(
feature = "std-load-id",
not(all(target_arch = "wasm32", target_os = "unknown"))
),
all(feature = "web-load-id", target_arch = "wasm32", target_os = "unknown")
)))]
mod numbered {
#[derive(Clone, Copy)]
pub(crate) struct Load;
impl Load {
pub(crate) fn next() -> Load {
Load
}
}
}
pub(crate) use numbered::Load;