From 3683399a95d4b357b42df9f36776e0be91678ceb Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin <35292584+Myriad-Dreamin@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:08:01 +0800 Subject: [PATCH] Add interface to disable timer (#6695) Co-authored-by: Derived Cat --- crates/typst-timing/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/typst-timing/src/lib.rs b/crates/typst-timing/src/lib.rs index 6da2cdf0..8329f7e2 100644 --- a/crates/typst-timing/src/lib.rs +++ b/crates/typst-timing/src/lib.rs @@ -71,6 +71,14 @@ pub fn enable() { ENABLED.store(true, Ordering::Relaxed); } +/// Disable the timer. +#[inline] +pub fn disable() { + // We only need atomicity and no synchronization of other + // operations, so `Relaxed` is fine. + ENABLED.store(false, Ordering::Relaxed); +} + /// Whether the timer is enabled. #[inline] pub fn is_enabled() -> bool {