Skip to main content

classify_timeout

Function classify_timeout 

Source
pub fn classify_timeout(
    timeout_secs: Option<u64>,
    elapsed: Duration,
) -> TimeoutClassification
Expand description

Deterministically classifies elapsed execution relative to configured timeout.

This is a pure, side-effect free operation suitable for standalone classification without any enforcement machinery.

ยงBoundary behavior

When elapsed == timeout, the result is TimeoutClassification::CompletedInTime. Only elapsed > timeout yields TimeoutClassification::TimedOut. Note that the watchdog thread fires at elapsed >= deadline, so cancellation may have been requested even for executions classified as CompletedInTime (a narrow race where the operation finishes in the same tick the watchdog fires). Callers should inspect CancellableExecution::cancel_requested for the authoritative cancellation signal.