Skip to main content

cageforge_command/
timeout.rs

1// SPDX-License-Identifier: Apache-2.0
2
3//! Timeout intent for [`crate::CommandRequest`].
4//!
5//! This module does not own cancellation or process lifecycle. It only keeps
6//! the requested timeout state available to the adapter.
7
8use std::time::Duration;
9
10/// Timeout intent for one command request.
11///
12/// The three variants preserve the distinction used by the execution
13/// boundary: use the backend's configured default, impose an explicit limit,
14/// or run without an automatic timeout. Cancellation is a separate lifecycle
15/// concern and may still terminate a command in any variant.
16#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
17pub enum TimeoutPolicy {
18    /// Use the default timeout selected by the backend or resolved profile.
19    #[default]
20    BackendDefault,
21    /// Terminate the command after the given duration.
22    Limit(Duration),
23    /// Do not apply an automatic timeout.
24    Disabled,
25}