Skip to main content

ifc_properties/pset/authoring/
builders.rs

1//! Constructors and builder setters for the drafts of the parent module,
2//! kept apart so the writer stays under the 800-line limit.
3
4#[allow(clippy::wildcard_imports)]
5use super::*;
6
7impl<'a> TableValueDraft<'a> {
8    /// Starts a draft from its required `name`; every other field is unset.
9    #[must_use]
10    pub fn new(name: &'a str) -> Self {
11        Self {
12            name,
13            specification: None,
14            defining: None,
15            defined: None,
16            defining_unit: None,
17            defined_unit: None,
18            expression: None,
19            interpolation: None,
20        }
21    }
22
23    /// Sets `specification`.
24    ///
25    /// `Specification`.
26    #[must_use]
27    pub fn specification(mut self, value: &'a str) -> Self {
28        self.specification = Some(value);
29        self
30    }
31
32    /// Sets `defining`.
33    ///
34    /// `DefiningValues`, the independent variable.
35    #[must_use]
36    pub fn defining(mut self, value: Vec<Value>) -> Self {
37        self.defining = Some(value);
38        self
39    }
40
41    /// Sets `defined`.
42    ///
43    /// `DefinedValues`, the dependent variable.
44    #[must_use]
45    pub fn defined(mut self, value: Vec<Value>) -> Self {
46        self.defined = Some(value);
47        self
48    }
49
50    /// Sets `defining_unit`.
51    ///
52    /// `DefiningUnit`.
53    #[must_use]
54    pub fn defining_unit(mut self, value: EntityId) -> Self {
55        self.defining_unit = Some(value);
56        self
57    }
58
59    /// Sets `defined_unit`.
60    ///
61    /// `DefinedUnit`.
62    #[must_use]
63    pub fn defined_unit(mut self, value: EntityId) -> Self {
64        self.defined_unit = Some(value);
65        self
66    }
67
68    /// Sets `expression`.
69    ///
70    /// `Expression`, the closed form when one exists.
71    #[must_use]
72    pub fn expression(mut self, value: &'a str) -> Self {
73        self.expression = Some(value);
74        self
75    }
76
77    /// Sets `interpolation`.
78    ///
79    /// `CurveInterpolation`, an `IfcCurveInterpolationEnum` token.
80    #[must_use]
81    pub fn interpolation(mut self, value: &'a str) -> Self {
82        self.interpolation = Some(value);
83        self
84    }
85}