dis_rs/common/action_request_r/
builder.rs1use crate::action_request_r::model::ActionRequestR;
2use crate::common::model::{EntityId, FixedDatum, VariableDatum};
3use crate::enumerations::{ActionId, RequiredReliabilityService};
4
5pub struct ActionRequestRBuilder(ActionRequestR);
6
7impl Default for ActionRequestRBuilder {
8 fn default() -> Self {
9 Self::new()
10 }
11}
12
13impl ActionRequestRBuilder {
14 #[must_use]
15 pub fn new() -> Self {
16 ActionRequestRBuilder(ActionRequestR::default())
17 }
18
19 #[must_use]
20 pub fn new_from_body(body: ActionRequestR) -> Self {
21 ActionRequestRBuilder(body)
22 }
23
24 #[must_use]
25 pub fn build(self) -> ActionRequestR {
26 self.0
27 }
28
29 #[must_use]
30 pub fn with_origination_id(mut self, originating_id: EntityId) -> Self {
31 self.0.originating_id = originating_id;
32 self
33 }
34
35 #[must_use]
36 pub fn with_receiving_id(mut self, receiving_id: EntityId) -> Self {
37 self.0.receiving_id = receiving_id;
38 self
39 }
40
41 #[must_use]
42 pub fn with_required_reliability_service(
43 mut self,
44 required_reliability_service: RequiredReliabilityService,
45 ) -> Self {
46 self.0.required_reliability_service = required_reliability_service;
47 self
48 }
49
50 #[must_use]
51 pub fn with_request_id(mut self, request_id: u32) -> Self {
52 self.0.request_id = request_id;
53 self
54 }
55
56 #[must_use]
57 pub fn with_action_id(mut self, action_id: ActionId) -> Self {
58 self.0.action_id = action_id;
59 self
60 }
61
62 #[must_use]
63 pub fn with_fixed_datums(mut self, fixed_datum_records: Vec<FixedDatum>) -> Self {
64 self.0.fixed_datum_records = fixed_datum_records;
65 self
66 }
67
68 #[must_use]
69 pub fn with_variable_datums(mut self, variable_datum_records: Vec<VariableDatum>) -> Self {
70 self.0.variable_datum_records = variable_datum_records;
71 self
72 }
73}