1use serde::{Deserialize, Serialize};
4use std::fmt;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
18pub struct RunId(pub ulid::Ulid);
19
20impl RunId {
21 pub fn new() -> Self {
23 Self(ulid::Ulid::new())
24 }
25}
26
27impl Default for RunId {
28 fn default() -> Self {
29 Self::new()
30 }
31}
32
33impl fmt::Display for RunId {
34 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
35 write!(f, "{}", self.0)
36 }
37}
38
39#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
41pub struct ThreadId(pub String);
42
43impl ThreadId {
44 pub fn new(s: impl Into<String>) -> Self {
46 Self(s.into())
47 }
48}
49
50impl fmt::Display for ThreadId {
51 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
52 f.write_str(&self.0)
53 }
54}
55
56#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
58pub struct JobId(pub String);
59
60impl JobId {
61 pub fn new(s: impl Into<String>) -> Self {
63 Self(s.into())
64 }
65}
66
67impl fmt::Display for JobId {
68 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
69 f.write_str(&self.0)
70 }
71}
72
73#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
75pub struct FactId(pub String);
76
77impl FactId {
78 pub fn new(s: impl Into<String>) -> Self {
80 Self(s.into())
81 }
82}
83
84impl fmt::Display for FactId {
85 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
86 f.write_str(&self.0)
87 }
88}
89
90#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
92pub struct DurableName(pub String);
93
94impl DurableName {
95 pub fn new(s: impl Into<String>) -> Self {
97 Self(s.into())
98 }
99}