nominal_api/conjure/objects/scout/chartdefinition/api/
spatial_time_binding.rs1#[derive(
5 Debug,
6 Clone,
7 conjure_object::serde::Serialize,
8 conjure_object::serde::Deserialize,
9 conjure_object::private::DeriveWith
10)]
11#[serde(crate = "conjure_object::serde")]
12#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct SpatialTimeBinding {
16 #[serde(rename = "enabled")]
17 enabled: bool,
18 #[builder(into)]
19 #[serde(rename = "attribute")]
20 attribute: String,
21 #[serde(rename = "unit")]
22 unit: super::SpatialTimeUnit,
23 #[builder(default, into)]
24 #[serde(
25 rename = "relativeStartUs",
26 skip_serializing_if = "Option::is_none",
27 default
28 )]
29 relative_start_us: Option<conjure_object::SafeLong>,
30 #[builder(default, into)]
31 #[serde(rename = "relativeEndUs", skip_serializing_if = "Option::is_none", default)]
32 relative_end_us: Option<conjure_object::SafeLong>,
33 #[builder(
34 default,
35 custom(
36 type = impl
37 Into<Option<super::SpatialTimeWindow>>,
38 convert = |v|v.into().map(Box::new)
39 )
40 )]
41 #[serde(rename = "timeWindow", skip_serializing_if = "Option::is_none", default)]
42 time_window: Option<Box<super::SpatialTimeWindow>>,
43}
44impl SpatialTimeBinding {
45 #[inline]
47 pub fn new(
48 enabled: bool,
49 attribute: impl Into<String>,
50 unit: super::SpatialTimeUnit,
51 ) -> Self {
52 Self::builder().enabled(enabled).attribute(attribute).unit(unit).build()
53 }
54 #[inline]
55 pub fn enabled(&self) -> bool {
56 self.enabled
57 }
58 #[inline]
60 pub fn attribute(&self) -> &str {
61 &*self.attribute
62 }
63 #[inline]
64 pub fn unit(&self) -> &super::SpatialTimeUnit {
65 &self.unit
66 }
67 #[inline]
71 pub fn relative_start_us(&self) -> Option<conjure_object::SafeLong> {
72 self.relative_start_us.as_ref().map(|o| *o)
73 }
74 #[inline]
78 pub fn relative_end_us(&self) -> Option<conjure_object::SafeLong> {
79 self.relative_end_us.as_ref().map(|o| *o)
80 }
81 #[inline]
83 pub fn time_window(&self) -> Option<&super::SpatialTimeWindow> {
84 self.time_window.as_ref().map(|o| &**o)
85 }
86}