mocra_core/common/model/
context.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Clone, Debug, Serialize, Deserialize, Default)]
7pub struct ExecutionMark {
8 pub module_id: Option<String>,
9 pub step_idx: Option<u32>,
12 pub epoch: Option<u64>,
13 #[serde(default)]
15 pub stay_current_step: bool,
16 #[serde(default, skip_serializing_if = "Option::is_none")]
20 pub node_id: Option<String>,
21}
22
23impl ExecutionMark {
24 pub fn with_module_id(mut self, mid: impl AsRef<str>) -> Self {
25 self.module_id = Some(mid.as_ref().into());
26 self
27 }
28 pub fn with_step_idx(mut self, idx: u32) -> Self {
29 self.step_idx = Some(idx);
30 self
31 }
32 pub fn with_epoch(mut self, epoch: u64) -> Self {
33 self.epoch = Some(epoch);
34 self
35 }
36 pub fn with_stay_current_step(mut self, stay: bool) -> Self {
37 self.stay_current_step = stay;
38 self
39 }
40 pub fn with_node_id(mut self, id: impl Into<String>) -> Self {
41 self.node_id = Some(id.into());
42 self
43 }
44}