bsp_types/task/progress.rs
1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4use crate::{TaskDataKind, TaskId};
5
6/// After a taskStart and before taskFinish for a taskId, the server may send any number of progress notifications.
7#[derive(Default, Debug, Serialize, Deserialize, Clone)]
8#[serde(rename_all = "camelCase", default)]
9pub struct TaskProgress {
10 /// Unique id of the task with optional reference to parent task id
11 pub task_id: TaskId,
12
13 /// Timestamp of when the progress event was generated in milliseconds since Epoch.
14 #[serde(skip_serializing_if = "Option::is_none")]
15 pub event_time: Option<u32>,
16
17 /// Message describing the task progress.
18 /// * Information about the state of the task at the time the event is sent.
19 #[serde(skip_serializing_if = "String::is_empty")]
20 pub message: String,
21
22 /// If known, total amount of work units in this task.
23 pub total: Option<u32>,
24
25 /// If known, completed amount of work units in this task.
26 pub progress: Option<u32>,
27
28 /// Name of a work unit. For example, "files" or "tests". May be empty.
29 #[serde(skip_serializing_if = "String::is_empty")]
30 pub unit: String,
31
32 /// Kind of data to expect in the `data` field. If this field is not set, the kind of data is not specified.
33 /// * Kind names for specific tasks like compile, test, etc are specified in the protocol.
34 #[serde(skip_serializing_if = "TaskDataKind::is_none")]
35 pub data_kind: TaskDataKind,
36
37 /// Optional metadata about the task.
38 /// * Objects for specific tasks like compile, test, etc are specified in the protocol.
39 #[serde(skip_serializing_if = "serde_json::Value::is_null")]
40 pub data: Value,
41}