nominal_api/conjure/objects/scout/chartdefinition/api/
geo3d_sensor.rs1#[derive(
3 Debug,
4 Clone,
5 conjure_object::serde::Serialize,
6 conjure_object::serde::Deserialize,
7 conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct Geo3dSensor {
14 #[builder(into)]
15 #[serde(rename = "sensorId")]
16 sensor_id: String,
17 #[builder(default, into)]
18 #[serde(rename = "enabled", skip_serializing_if = "Option::is_none", default)]
19 enabled: Option<bool>,
20 #[builder(default, into)]
21 #[serde(rename = "name", skip_serializing_if = "Option::is_none", default)]
22 name: Option<String>,
23 #[builder(
24 default,
25 custom(
26 type = impl
27 Into<Option<super::Geo3dSensorOrientationConfig>>,
28 convert = |v|v.into().map(Box::new)
29 )
30 )]
31 #[serde(rename = "orientation", skip_serializing_if = "Option::is_none", default)]
32 orientation: Option<Box<super::Geo3dSensorOrientationConfig>>,
33 #[builder(default, into)]
34 #[serde(rename = "color", skip_serializing_if = "Option::is_none", default)]
35 color: Option<super::super::super::api::HexColor>,
36 #[builder(
37 default,
38 custom(
39 type = impl
40 Into<Option<super::Geo3dSensorShape>>,
41 convert = |v|v.into().map(Box::new)
42 )
43 )]
44 #[serde(rename = "viewShape", skip_serializing_if = "Option::is_none", default)]
45 view_shape: Option<Box<super::Geo3dSensorShape>>,
46}
47impl Geo3dSensor {
48 #[inline]
50 pub fn new(sensor_id: impl Into<String>) -> Self {
51 Self::builder().sensor_id(sensor_id).build()
52 }
53 #[inline]
54 pub fn sensor_id(&self) -> &str {
55 &*self.sensor_id
56 }
57 #[inline]
58 pub fn enabled(&self) -> Option<bool> {
59 self.enabled.as_ref().map(|o| *o)
60 }
61 #[inline]
63 pub fn name(&self) -> Option<&str> {
64 self.name.as_ref().map(|o| &**o)
65 }
66 #[inline]
68 pub fn orientation(&self) -> Option<&super::Geo3dSensorOrientationConfig> {
69 self.orientation.as_ref().map(|o| &**o)
70 }
71 #[inline]
73 pub fn color(&self) -> Option<&super::super::super::api::HexColor> {
74 self.color.as_ref().map(|o| &*o)
75 }
76 #[inline]
78 pub fn view_shape(&self) -> Option<&super::Geo3dSensorShape> {
79 self.view_shape.as_ref().map(|o| &**o)
80 }
81}