dis_rs/common/start_resume/
builder.rs

1use crate::model::{ClockTime, EntityId};
2use crate::start_resume::model::StartResume;
3
4pub struct StartResumeBuilder(StartResume);
5
6impl Default for StartResumeBuilder {
7    fn default() -> Self {
8        Self::new()
9    }
10}
11
12impl StartResumeBuilder {
13    #[must_use]
14    pub fn new() -> Self {
15        StartResumeBuilder(StartResume::default())
16    }
17
18    #[must_use]
19    pub fn new_from_body(body: StartResume) -> Self {
20        StartResumeBuilder(body)
21    }
22
23    #[must_use]
24    pub fn build(self) -> StartResume {
25        self.0
26    }
27
28    #[must_use]
29    pub fn with_origination_id(mut self, originating_id: EntityId) -> Self {
30        self.0.originating_id = originating_id;
31        self
32    }
33
34    #[must_use]
35    pub fn with_receiving_id(mut self, receiving_id: EntityId) -> Self {
36        self.0.receiving_id = receiving_id;
37        self
38    }
39
40    #[must_use]
41    pub fn with_real_world_time(mut self, real_world_time: ClockTime) -> Self {
42        self.0.real_world_time = real_world_time;
43        self
44    }
45
46    #[must_use]
47    pub fn with_simulation_time(mut self, simulation_time: ClockTime) -> Self {
48        self.0.simulation_time = simulation_time;
49        self
50    }
51
52    #[must_use]
53    pub fn with_request_id(mut self, request_id: u32) -> Self {
54        self.0.request_id = request_id;
55        self
56    }
57}