#[derive(
Debug,
Clone,
conjure_object::serde::Serialize,
conjure_object::serde::Deserialize,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct ChannelMetadata {
#[serde(rename = "name")]
name: super::Channel,
#[builder(
custom(type = super::super::super::run::api::DataSource, convert = Box::new)
)]
#[serde(rename = "dataSource")]
data_source: Box<super::super::super::run::api::DataSource>,
#[builder(
default,
custom(
type = impl
Into<Option<super::super::super::run::api::Unit>>,
convert = |v|v.into().map(Box::new)
)
)]
#[serde(rename = "unit", skip_serializing_if = "Option::is_none", default)]
unit: Option<Box<super::super::super::run::api::Unit>>,
#[builder(default, into)]
#[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
description: Option<String>,
#[builder(default, into)]
#[serde(rename = "dataType", skip_serializing_if = "Option::is_none", default)]
data_type: Option<super::super::super::super::api::SeriesDataType>,
}
impl ChannelMetadata {
#[inline]
pub fn new(
name: super::Channel,
data_source: super::super::super::run::api::DataSource,
) -> Self {
Self::builder().name(name).data_source(data_source).build()
}
#[inline]
pub fn name(&self) -> &super::Channel {
&self.name
}
#[inline]
pub fn data_source(&self) -> &super::super::super::run::api::DataSource {
&*self.data_source
}
#[inline]
pub fn unit(&self) -> Option<&super::super::super::run::api::Unit> {
self.unit.as_ref().map(|o| &**o)
}
#[inline]
pub fn description(&self) -> Option<&str> {
self.description.as_ref().map(|o| &**o)
}
#[inline]
pub fn data_type(&self) -> Option<&super::super::super::super::api::SeriesDataType> {
self.data_type.as_ref().map(|o| &*o)
}
}