Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
table_column_numeric_config.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 TableColumnNumericConfig {
16    #[builder(custom(type = super::TableColumnNumericAggregation, convert = Box::new))]
17    #[serde(rename = "aggregation")]
18    aggregation: Box<super::TableColumnNumericAggregation>,
19    #[builder(
20        default,
21        custom(
22            type = impl
23            Into<Option<super::TableColumnNumericAggregation>>,
24            convert = |v|v.into().map(Box::new)
25        )
26    )]
27    #[serde(
28        rename = "summaryRowAggregation",
29        skip_serializing_if = "Option::is_none",
30        default
31    )]
32    summary_row_aggregation: Option<Box<super::TableColumnNumericAggregation>>,
33    #[builder(
34        default,
35        custom(
36            type = impl
37            Into<Option<super::NumberFormat>>,
38            convert = |v|v.into().map(Box::new)
39        )
40    )]
41    #[serde(rename = "numberFormat", skip_serializing_if = "Option::is_none", default)]
42    number_format: Option<Box<super::NumberFormat>>,
43}
44impl TableColumnNumericConfig {
45    /// Constructs a new instance of the type.
46    #[inline]
47    pub fn new(aggregation: super::TableColumnNumericAggregation) -> Self {
48        Self::builder().aggregation(aggregation).build()
49    }
50    #[inline]
51    pub fn aggregation(&self) -> &super::TableColumnNumericAggregation {
52        &*self.aggregation
53    }
54    #[inline]
55    pub fn summary_row_aggregation(
56        &self,
57    ) -> Option<&super::TableColumnNumericAggregation> {
58        self.summary_row_aggregation.as_ref().map(|o| &**o)
59    }
60    /// Optional per-column number formatting. If unset, the panel-level
61    /// default formatting is used.
62    #[inline]
63    pub fn number_format(&self) -> Option<&super::NumberFormat> {
64        self.number_format.as_ref().map(|o| &**o)
65    }
66}