Skip to main content

evaluate_guards

Function evaluate_guards 

Source
pub(super) fn evaluate_guards(
    s: &Settings,
    now_min: u32,
    dnd_active: bool,
    camera_active: bool,
    video_active: bool,
    app_pause_active: bool,
) -> Option<GuardOutcome>
Expand description

Pure decision: given the per-tick guard inputs, return which SuppressReason should fire (if any) and whether the run-loop should also write a GuardSuppress event for it.

Precedence (first match wins, mirroring the run-loop order): work_window → dnd → camera → video → app_pause. The run-loop is expected to short-circuit expensive checks before passing them in (e.g. only calling dnd::is_active() when pause_during_dnd is set), so the booleans here are “is the condition live right now”, and the function applies the setting gates itself.