dis_rs/common/create_entity/
builder.rs

1use crate::common::create_entity::model::CreateEntity;
2use crate::common::model::EntityId;
3
4pub struct CreateEntityBuilder(CreateEntity);
5
6impl Default for CreateEntityBuilder {
7    fn default() -> Self {
8        Self::new()
9    }
10}
11
12impl CreateEntityBuilder {
13    #[must_use]
14    pub fn new() -> Self {
15        CreateEntityBuilder(CreateEntity::default())
16    }
17
18    #[must_use]
19    pub fn new_from_body(body: CreateEntity) -> Self {
20        CreateEntityBuilder(body)
21    }
22
23    #[must_use]
24    pub fn build(self) -> CreateEntity {
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_request_id(mut self, request_id: u32) -> Self {
42        self.0.request_id = request_id;
43        self
44    }
45}