bsp_types/task/
start.rs

1use crate::TaskDataKind;
2use crate::TaskId;
3use serde::{Deserialize, Serialize};
4use serde_json::Value;
5
6#[derive(Default, Debug, Serialize, Deserialize, Clone)]
7#[serde(rename_all = "camelCase", default)]
8pub struct TaskStart {
9    /// Unique id of the task with optional reference to parent task id
10    pub task_id: super::TaskId,
11
12    /// Timestamp of when the event started in milliseconds since Epoch.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub event_time: Option<u32>,
15
16    /// Message describing the task.
17    #[serde(skip_serializing_if = "String::is_empty")]
18    pub message: String,
19
20    /// Kind of data to expect in the `data` field. If this field is not set, the kind of data is
21    /// not specified.
22    /// * Kind names for specific tasks like compile, test, etc are specified in the protocol.
23    #[serde(skip_serializing_if = "TaskDataKind::is_none")]
24    pub data_kind: TaskDataKind,
25
26    /// Optional metadata about the task.
27    /// * Objects for specific tasks like compile, test, etc are specified in the protocol.
28    #[serde(skip_serializing_if = "serde_json::Value::is_null")]
29    pub data: Value,
30}
31
32impl TaskStart {
33    pub fn new(task_id: impl Into<TaskId>) -> Self {
34        Self {
35            task_id: task_id.into(),
36            ..Self::default()
37        }
38    }
39}