dis_rs/common/data_query/
builder.rs1use crate::common::data_query::model::DataQuery;
2use crate::common::model::{EntityId, Timestamp};
3use crate::enumerations::VariableRecordType;
4use alloc::vec::Vec;
5
6pub struct DataQueryBuilder(DataQuery);
7
8impl Default for DataQueryBuilder {
9 fn default() -> Self {
10 Self::new()
11 }
12}
13
14impl DataQueryBuilder {
15 #[must_use]
16 pub fn new() -> Self {
17 DataQueryBuilder(DataQuery::default())
18 }
19
20 #[must_use]
21 pub fn new_from_body(body: DataQuery) -> Self {
22 DataQueryBuilder(body)
23 }
24
25 #[must_use]
26 pub fn build(self) -> DataQuery {
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_time_interval(mut self, time_interval: Timestamp) -> Self {
50 self.0.time_interval = time_interval;
51 self
52 }
53
54 #[must_use]
55 pub fn with_fixed_datums(mut self, fixed_datum_records: Vec<VariableRecordType>) -> Self {
56 self.0.fixed_datum_records = fixed_datum_records;
57 self
58 }
59
60 #[must_use]
61 pub fn with_variable_datums(mut self, variable_datum_records: Vec<VariableRecordType>) -> Self {
62 self.0.variable_datum_records = variable_datum_records;
63 self
64 }
65}