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