dis_rs/common/is_part_of/
builder.rs1use crate::is_part_of::model::{IsPartOf, NamedLocationId, Relationship};
2use crate::model::{EntityId, EntityType, VectorF32};
3
4pub struct IsPartOfBuilder(IsPartOf);
5
6impl Default for IsPartOfBuilder {
7 fn default() -> Self {
8 Self::new()
9 }
10}
11
12impl IsPartOfBuilder {
13 #[must_use]
14 pub fn new() -> Self {
15 IsPartOfBuilder(IsPartOf::default())
16 }
17
18 #[must_use]
19 pub fn new_from_body(body: IsPartOf) -> Self {
20 IsPartOfBuilder(body)
21 }
22
23 #[must_use]
24 pub fn build(self) -> IsPartOf {
25 self.0
26 }
27
28 #[must_use]
29 pub fn with_originating_simulation_id(mut self, originating_simulation_id: EntityId) -> Self {
30 self.0.originating_simulation_id = originating_simulation_id;
31 self
32 }
33
34 #[must_use]
35 pub fn with_receiving_entity_id(mut self, receiving_entity_id: EntityId) -> Self {
36 self.0.receiving_entity_id = receiving_entity_id;
37 self
38 }
39
40 #[must_use]
41 pub fn with_relationship(mut self, relationship: Relationship) -> Self {
42 self.0.relationship = relationship;
43 self
44 }
45
46 #[must_use]
47 pub fn with_part_location(mut self, part_location: VectorF32) -> Self {
48 self.0.part_location = part_location;
49 self
50 }
51
52 #[must_use]
53 pub fn with_named_location_id(mut self, named_location_id: NamedLocationId) -> Self {
54 self.0.named_location_id = named_location_id;
55 self
56 }
57
58 #[must_use]
59 pub fn with_part_type(mut self, part_type: EntityType) -> Self {
60 self.0.part_type = part_type;
61 self
62 }
63}