nominal_api/conjure/objects/scout/run/api/
channel_metadata.rs1#[derive(
2 Debug,
3 Clone,
4 conjure_object::serde::Serialize,
5 conjure_object::serde::Deserialize,
6 PartialEq,
7 Eq,
8 PartialOrd,
9 Ord,
10 Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct ChannelMetadata {
16 #[builder(into)]
17 #[serde(rename = "name")]
18 name: String,
19 #[builder(custom(type = super::DataSource, convert = Box::new))]
20 #[serde(rename = "dataSource")]
21 data_source: Box<super::DataSource>,
22 #[builder(
23 default,
24 custom(
25 type = impl
26 Into<Option<super::Unit>>,
27 convert = |v|v.into().map(Box::new)
28 )
29 )]
30 #[serde(rename = "unit", skip_serializing_if = "Option::is_none", default)]
31 unit: Option<Box<super::Unit>>,
32 #[builder(default, into)]
33 #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
34 description: Option<String>,
35 #[builder(default, into)]
36 #[serde(rename = "dataType", skip_serializing_if = "Option::is_none", default)]
37 data_type: Option<super::super::super::super::api::SeriesDataType>,
38}
39impl ChannelMetadata {
40 #[inline]
42 pub fn new(name: impl Into<String>, data_source: super::DataSource) -> Self {
43 Self::builder().name(name).data_source(data_source).build()
44 }
45 #[inline]
46 pub fn name(&self) -> &str {
47 &*self.name
48 }
49 #[inline]
50 pub fn data_source(&self) -> &super::DataSource {
51 &*self.data_source
52 }
53 #[inline]
54 pub fn unit(&self) -> Option<&super::Unit> {
55 self.unit.as_ref().map(|o| &**o)
56 }
57 #[inline]
58 pub fn description(&self) -> Option<&str> {
59 self.description.as_ref().map(|o| &**o)
60 }
61 #[inline]
62 pub fn data_type(&self) -> Option<&super::super::super::super::api::SeriesDataType> {
63 self.data_type.as_ref().map(|o| &*o)
64 }
65}