pub enum Status {
Pending {
total: Option<usize>,
},
Error {
message: String,
},
Finished,
Running,
InProgress {
done: usize,
total: usize,
},
}
Expand description
Represents the status of a task.
There are 3 main states: Pending, Running, and finished. But since there are 2 types of running (iterative or spinner) and 3 types of finished (success and error), thus 5 variants
Variants§
Pending
Represents a pending task, waiting to be executed.
The total
field is optional. If it exists/is not null,
it means the task is iterative and has a known end
Otherwise, we assume it to be a spinner task.
The total field exists in this Pending
variant since if we use, say
Status::InProgress{done: 0, total: X};
to represent a pending task with a known total instead of
Status::Pending{total: X};
it is ambiguous whether or not the task has already started or not.
Error
Self-explanatory
Finished
Self-explanatory
Running
Like InProgress
but for non-iterative tasks (unknown total)
InProgress
An iterative task (known end and/or subtasks) is running.
done
out of total
tasks were finished
The subtasks
field is currently unused but will be
in the future when we implement nested tasks
TODO: implement subtasks