euv-core 0.47.0

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// Returns process-cached system font and GPU adapter probe metadata without re-probing OS drivers on subsequent calls.
///
/// # Returns
///
/// - `(SystemFontInfo, GpuAdapterInfo)` - Cached native font and Metal/host GPU adapter information.
#[must_use]
pub fn cached_window_hardware_probe() -> (SystemFontInfo, GpuAdapterInfo) {
    #[cfg(not(target_arch = "wasm32"))]
    {
        CACHED_HARDWARE_PROBE
            .get_or_init(|| {
                let font_info: SystemFontInfo = NativeSystemFont::system().font_info();
                let gpu_driver: NativeGpuDriver = NativeGpuDriver::probe(GraphicsBackend::Metal);
                let gpu_info: GpuAdapterInfo = gpu_driver.get_adapter().clone();
                (font_info, gpu_info)
            })
            .clone()
    }
    #[cfg(target_arch = "wasm32")]
    {
        CACHED_HARDWARE_PROBE.with(|slot: &RefCell<Option<(SystemFontInfo, GpuAdapterInfo)>>| {
            if let Ok(guard) = slot.try_borrow()
                && let Some(cached) = guard.as_ref()
            {
                return cached.clone();
            }
            let font_info: SystemFontInfo = NativeSystemFont::system().font_info();
            let gpu_driver: NativeGpuDriver = NativeGpuDriver::probe(GraphicsBackend::Metal);
            let gpu_info: GpuAdapterInfo = gpu_driver.get_adapter().clone();
            let pair: (SystemFontInfo, GpuAdapterInfo) = (font_info, gpu_info);
            if let Ok(mut guard) = slot.try_borrow_mut() {
                *guard = Some(pair.clone());
            }
            pair
        })
    }
}