ftui_runtime/
voi_telemetry.rs1#![forbid(unsafe_code)]
2
3use std::sync::{LazyLock, RwLock};
6
7use crate::voi_sampling::VoiSamplerSnapshot;
8
9static INLINE_AUTO_VOI_SNAPSHOT: LazyLock<RwLock<Option<VoiSamplerSnapshot>>> =
10 LazyLock::new(|| RwLock::new(None));
11
12pub fn set_inline_auto_voi_snapshot(snapshot: Option<VoiSamplerSnapshot>) {
14 if let Ok(mut guard) = INLINE_AUTO_VOI_SNAPSHOT.write() {
15 *guard = snapshot;
16 }
17}
18
19#[must_use]
21pub fn inline_auto_voi_snapshot() -> Option<VoiSamplerSnapshot> {
22 INLINE_AUTO_VOI_SNAPSHOT
23 .read()
24 .ok()
25 .and_then(|guard| guard.clone())
26}
27
28pub fn clear_inline_auto_voi_snapshot() {
30 set_inline_auto_voi_snapshot(None);
31}