Skip to main content

nominal_api/conjure/objects/scout/savedviews/api/
metric_column_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 MetricColumnMetadata {
16    #[builder(into)]
17    #[serde(rename = "title")]
18    title: String,
19    #[builder(default, into)]
20    #[serde(rename = "description", skip_serializing_if = "Option::is_none", default)]
21    description: Option<String>,
22    #[builder(
23        default,
24        custom(
25            type = impl
26            Into<Option<super::super::super::api::Symbol>>,
27            convert = |v|v.into().map(Box::new)
28        )
29    )]
30    #[serde(rename = "symbol", skip_serializing_if = "Option::is_none", default)]
31    symbol: Option<Box<super::super::super::api::Symbol>>,
32}
33impl MetricColumnMetadata {
34    /// Constructs a new instance of the type.
35    #[inline]
36    pub fn new(title: impl Into<String>) -> Self {
37        Self::builder().title(title).build()
38    }
39    #[inline]
40    pub fn title(&self) -> &str {
41        &*self.title
42    }
43    #[inline]
44    pub fn description(&self) -> Option<&str> {
45        self.description.as_ref().map(|o| &**o)
46    }
47    #[inline]
48    pub fn symbol(&self) -> Option<&super::super::super::api::Symbol> {
49        self.symbol.as_ref().map(|o| &**o)
50    }
51}