Skip to main content

turbo_tasks/
task_execution_reason.rs

1#[derive(Debug)]
2pub enum TaskExecutionReason {
3    /// A root task was initially scheduled and is executed
4    Root,
5    /// A task output was read, but the output is not available, so the task was scheduled and
6    /// executed to produce the output
7    OutputNotAvailable,
8    /// A task cell was read, but the cell content is not available, so the task was scheduled and
9    /// executed to produce the cell content
10    CellNotAvailable,
11    /// A task was marked as dirty and is active on it's own (maybe root or currently awaited), so
12    /// it was scheduled and executed to update the task output
13    Invalidated,
14    /// A dirty task has been activated, so it was scheduled and executed to update the task output
15    ActivateDirty,
16    /// A task has been activated for the first time (no output yet), so it was scheduled and
17    /// executed to produce the task output
18    ActivateInitial,
19    /// A task was connected as child in `active_tracking == false` mode for the first time (no
20    /// output yet), so it was scheduled and executed to produce the task output.
21    /// Or a task was called inside of a turbo_tasks::run closure for the first time (no output
22    /// yet), so it was scheduled and executed to produce the task output.
23    Connect,
24    /// An in-progress task was marked as stale, so it was scheduled again after execution and is
25    /// executing again to update the task output.
26    Stale,
27}
28
29impl TaskExecutionReason {
30    pub fn as_str(&self) -> &'static str {
31        match self {
32            TaskExecutionReason::Root => "root",
33            TaskExecutionReason::OutputNotAvailable => "output_not_available",
34            TaskExecutionReason::CellNotAvailable => "cell_not_available",
35            TaskExecutionReason::Invalidated => "invalidated",
36            TaskExecutionReason::ActivateDirty => "activate_dirty",
37            TaskExecutionReason::ActivateInitial => "activate_initial",
38            TaskExecutionReason::Connect => "connect",
39            TaskExecutionReason::Stale => "stale",
40        }
41    }
42}