dis_rs/common/comment/
builder.rs1use crate::common::comment::model::Comment;
2use crate::common::model::{EntityId, VariableDatum};
3
4pub struct CommentBuilder(Comment);
5
6impl Default for CommentBuilder {
7 fn default() -> Self {
8 Self::new()
9 }
10}
11
12impl CommentBuilder {
13 #[must_use]
14 pub fn new() -> Self {
15 CommentBuilder(Comment::default())
16 }
17
18 #[must_use]
19 pub fn new_from_body(body: Comment) -> Self {
20 CommentBuilder(body)
21 }
22
23 #[must_use]
24 pub fn build(self) -> Comment {
25 self.0
26 }
27
28 #[must_use]
29 pub fn with_origination_id(mut self, originating_id: EntityId) -> Self {
30 self.0.originating_id = originating_id;
31 self
32 }
33
34 #[must_use]
35 pub fn with_receiving_id(mut self, receiving_id: EntityId) -> Self {
36 self.0.receiving_id = receiving_id;
37 self
38 }
39
40 #[must_use]
41 pub fn with_variable_datums(mut self, variable_datum_records: Vec<VariableDatum>) -> Self {
42 self.0.variable_datum_records = variable_datum_records;
43 self
44 }
45}