dis_rs/common/start_resume/
model.rs1use crate::common::model::{ClockTime, EntityId, PduBody};
2use crate::common::{BodyInfo, Interaction};
3use crate::enumerations::PduType;
4use crate::start_resume::builder::StartResumeBuilder;
5#[cfg(feature = "serde")]
6use serde::{Deserialize, Serialize};
7
8const START_RESUME_BODY_LENGTH: u16 = 32;
9
10#[derive(Clone, Debug, Default, PartialEq)]
14#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
15pub struct StartResume {
16 pub originating_id: EntityId,
17 pub receiving_id: EntityId,
18 pub real_world_time: ClockTime,
19 pub simulation_time: ClockTime,
20 pub request_id: u32,
21}
22
23impl StartResume {
24 #[must_use]
25 pub fn builder() -> StartResumeBuilder {
26 StartResumeBuilder::new()
27 }
28
29 #[must_use]
30 pub fn into_builder(self) -> StartResumeBuilder {
31 StartResumeBuilder::new_from_body(self)
32 }
33
34 #[must_use]
35 pub fn into_pdu_body(self) -> PduBody {
36 PduBody::StartResume(self)
37 }
38}
39
40impl BodyInfo for StartResume {
41 fn body_length(&self) -> u16 {
42 START_RESUME_BODY_LENGTH
43 }
44
45 fn body_type(&self) -> PduType {
46 PduType::StartResume
47 }
48}
49
50impl Interaction for StartResume {
51 fn originator(&self) -> Option<&EntityId> {
52 Some(&self.originating_id)
53 }
54
55 fn receiver(&self) -> Option<&EntityId> {
56 Some(&self.receiving_id)
57 }
58}