Skip to main content

nominal_api/conjure/objects/timeseries/channelmetadata/api/
channel_metadata.rs

1#[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(custom(type = super::ChannelIdentifier, convert = Box::new))]
17    #[serde(rename = "channelIdentifier")]
18    channel_identifier: Box<super::ChannelIdentifier>,
19    #[builder(default, into)]
20    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
21    description: Option<String>,
22    #[builder(default, into)]
23    #[serde(rename = "unit", skip_serializing_if = "Option::is_none", default)]
24    unit: Option<super::super::super::super::api::Unit>,
25    #[builder(default, into)]
26    #[serde(rename = "dataType", skip_serializing_if = "Option::is_none", default)]
27    data_type: Option<super::super::super::super::api::SeriesDataType>,
28}
29impl ChannelMetadata {
30    /// Constructs a new instance of the type.
31    #[inline]
32    pub fn new(channel_identifier: super::ChannelIdentifier) -> Self {
33        Self::builder().channel_identifier(channel_identifier).build()
34    }
35    #[inline]
36    pub fn channel_identifier(&self) -> &super::ChannelIdentifier {
37        &*self.channel_identifier
38    }
39    #[inline]
40    pub fn description(&self) -> Option<&str> {
41        self.description.as_ref().map(|o| &**o)
42    }
43    #[inline]
44    pub fn unit(&self) -> Option<&super::super::super::super::api::Unit> {
45        self.unit.as_ref().map(|o| &*o)
46    }
47    #[inline]
48    pub fn data_type(&self) -> Option<&super::super::super::super::api::SeriesDataType> {
49        self.data_type.as_ref().map(|o| &*o)
50    }
51}