dis_rs/common/record_query_r/
builder.rs

1use crate::common::model::EntityId;
2use crate::enumerations::{RecordQueryREventType, RequiredReliabilityService};
3use crate::model::TimeStamp;
4use crate::record_query_r::model::{RecordQueryR, RecordQuerySpecification};
5
6pub struct RecordQueryRBuilder(RecordQueryR);
7
8impl Default for RecordQueryRBuilder {
9    fn default() -> Self {
10        Self::new()
11    }
12}
13
14impl RecordQueryRBuilder {
15    #[must_use]
16    pub fn new() -> Self {
17        RecordQueryRBuilder(RecordQueryR::default())
18    }
19
20    #[must_use]
21    pub fn new_from_body(body: RecordQueryR) -> Self {
22        RecordQueryRBuilder(body)
23    }
24
25    #[must_use]
26    pub fn build(self) -> RecordQueryR {
27        self.0
28    }
29
30    #[must_use]
31    pub fn with_origination_id(mut self, originating_id: EntityId) -> Self {
32        self.0.originating_id = originating_id;
33        self
34    }
35
36    #[must_use]
37    pub fn with_receiving_id(mut self, receiving_id: EntityId) -> Self {
38        self.0.receiving_id = receiving_id;
39        self
40    }
41
42    #[must_use]
43    pub fn with_request_id(mut self, request_id: u32) -> Self {
44        self.0.request_id = request_id;
45        self
46    }
47
48    #[must_use]
49    pub fn with_required_reliability_service(
50        mut self,
51        required_reliability_service: RequiredReliabilityService,
52    ) -> Self {
53        self.0.required_reliability_service = required_reliability_service;
54        self
55    }
56
57    #[must_use]
58    pub fn with_event_type(mut self, event_type: RecordQueryREventType) -> Self {
59        self.0.event_type = event_type;
60        self
61    }
62
63    #[must_use]
64    pub fn with_time(mut self, time: TimeStamp) -> Self {
65        self.0.time = time;
66        self
67    }
68
69    #[must_use]
70    pub fn with_record_query_specification(
71        mut self,
72        record_query_specification: RecordQuerySpecification,
73    ) -> Self {
74        self.0.record_query_specification = record_query_specification;
75        self
76    }
77}