chord_flow/flow/task/
arg.rs1use std::fmt::{Display, Formatter};
2
3use chord_core::task::TaskId;
4
5#[derive(Debug, Clone)]
6pub struct TaskIdSimple {
7 exec_id: String,
8 task: String,
9}
10
11impl TaskIdSimple {
12 pub fn new(exec_id: String, task_id: String) -> TaskIdSimple {
13 TaskIdSimple {
14 exec_id,
15 task: task_id,
16 }
17 }
18}
19
20impl TaskId for TaskIdSimple {
21 fn task(&self) -> &str {
22 self.task.as_str()
23 }
24
25 fn exec_id(&self) -> &str {
26 self.exec_id.as_str()
27 }
28}
29
30impl Display for TaskIdSimple {
31 fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
32 f.write_str(format!("{}-{}", self.exec_id, self.task).as_str())
33 }
34}