Expand description
Retry policies and timeout-enforced task helpers.
Provides RetryPolicy for configurable retry-with-backoff and
task_with_timeout / task_with_retry constructors that wrap
Cmd::Task with deterministic lifecycle guarantees.
§Migration rationale
Source frameworks often have retry/timeout baked into effect middleware. These helpers give the migration code emitter explicit, testable primitives to target instead of ad-hoc retry loops.
§Determinism
Backoff delays use fixed formulas (no jitter/randomness) so that replay-based determinism tests can reproduce exact timing sequences.
§Example
use ftui_runtime::retry::{RetryPolicy, BackoffStrategy};
use std::time::Duration;
let policy = RetryPolicy::new(3, BackoffStrategy::Exponential {
base_ms: 100,
max_ms: 5000,
});
assert_eq!(policy.delay(0), Duration::from_millis(100));
assert_eq!(policy.delay(1), Duration::from_millis(200));
assert_eq!(policy.delay(2), Duration::from_millis(400));Structs§
- Retry
Policy - A retry policy with configurable attempts and backoff.
Enums§
- Backoff
Strategy - Backoff strategy for retry delays.
Functions§
- task_
with_ retry - Create a
Cmd::Taskthat retries on failure with the given policy. - task_
with_ retry_ and_ timeout - Create a
Cmd::Taskwith both retry and timeout. - task_
with_ timeout - Create a
Cmd::Taskthat enforces a cooperative timeout. - task_
with_ timeout_ named - Create a
Cmd::Taskwith a named spec and cooperative timeout.