Skip to main content

dis_rs/common/comment/
builder.rs

1use crate::common::comment::model::Comment;
2use crate::common::model::{EntityId, VariableDatum};
3use alloc::vec::Vec;
4
5pub struct CommentBuilder(Comment);
6
7impl Default for CommentBuilder {
8    fn default() -> Self {
9        Self::new()
10    }
11}
12
13impl CommentBuilder {
14    #[must_use]
15    pub fn new() -> Self {
16        CommentBuilder(Comment::default())
17    }
18
19    #[must_use]
20    pub fn new_from_body(body: Comment) -> Self {
21        CommentBuilder(body)
22    }
23
24    #[must_use]
25    pub fn build(self) -> Comment {
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_variable_datums(mut self, variable_datum_records: Vec<VariableDatum>) -> Self {
43        self.0.variable_datum_records = variable_datum_records;
44        self
45    }
46}