dis_rs/common/other/
builder.rs1use crate::common::other::model::Other;
2use crate::model::EntityId;
3
4pub struct OtherBuilder(Other);
5
6impl Default for OtherBuilder {
7 fn default() -> Self {
8 Self::new()
9 }
10}
11
12impl OtherBuilder {
13 #[must_use]
14 pub fn new() -> Self {
15 OtherBuilder(Other::default())
16 }
17
18 #[must_use]
19 pub fn new_from_body(body: Other) -> Self {
20 OtherBuilder(body)
21 }
22
23 #[must_use]
24 pub fn build(self) -> Other {
25 self.0
26 }
27
28 #[must_use]
29 pub fn with_origin(mut self, origin: Option<EntityId>) -> Self {
30 self.0.originating_entity_id = origin;
31 self
32 }
33
34 #[must_use]
35 pub fn with_receiver(mut self, receiver: Option<EntityId>) -> Self {
36 self.0.receiving_entity_id = receiver;
37 self
38 }
39
40 #[must_use]
41 pub fn with_body(mut self, body: Vec<u8>) -> Self {
42 self.0.body = body;
43 self
44 }
45}