bsp_types/task/
finish.rs

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