1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Defines the work that Taskvisor runs and supervises.
//!
//! Most applications start with [`TaskFn::arc`]: provide an async closure that creates one attempt,
//! then place the returned [`TaskRef`] in a [`TaskSpec`]. Use the spec constructor that matches the intended lifecycle:
//!
//! - [`TaskSpec::once`] runs at most one attempt;
//! - [`TaskSpec::restartable`] retries retryable failures;
//! - [`TaskSpec::periodic`] repeats after success and may retry retryable failures;
//! - [`TaskSpec::from_defaults`] leaves every execution choice to [`TaskDefaults`](crate::TaskDefaults).
//!
//! Implement [`Task`] directly when a named type is clearer than a closure. Pass the finished spec to a supervisor
//! run method or a management handle. Admission resolves inherited settings before Taskvisor starts the first attempt.
//!
//! ```text
//! application
//! ├── closure ──► TaskFn ──► TaskRef
//! └── named type ──► impl Task ──► TaskRef
//! │ TaskSpec
//! ▼
//! supervisor or controller admission
//! ▼
//! registry
//! │ TaskDefaults
//! ▼
//! TaskActor ──► one attempt at a time
//! ```
//!
//! | Type | Purpose |
//! |-------------------|---------------------------------------------------------|
//! | [`Task`] | Contract for creating one attempt future |
//! | [`TaskFn`] | Closure adapter for [`Task`] |
//! | [`TaskRef`] | Shared `Arc<dyn Task>` |
//! | [`TaskSpec`] | Registration name and execution settings |
//! | [`TaskSetting`] | Explicit or inherited setting |
//! | [`TaskContext`] | Cooperative cancellation for one attempt |
//! | [`BoxTaskFuture`] | Erased future returned by [`Task::spawn`] |
//!
//! A task object may be used for several attempts or registrations. Every call to [`Task::spawn`]
//! must return a new future. Long-running attempts must observe [`TaskContext`] cancellation.
//! A timeout drops the attempt future. Force-abort asks Tokio to drop it after the current poll returns.
//! Neither action undoes external side effects or interrupts synchronous code.
pub use ;
pub use ;
pub use TaskContext;
pub use r#