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::NumberFormat>>,
24            convert = |v|v.into().map(Box::new)
25        )
26    )]
27    #[serde(rename = "numberFormat", skip_serializing_if = "Option::is_none", default)]
28    number_format: Option<Box<super::NumberFormat>>,
29}
30impl TableColumnNumericConfig {
31    /// Constructs a new instance of the type.
32    #[inline]
33    pub fn new(aggregation: super::TableColumnNumericAggregation) -> Self {
34        Self::builder().aggregation(aggregation).build()
35    }
36    #[inline]
37    pub fn aggregation(&self) -> &super::TableColumnNumericAggregation {
38        &*self.aggregation
39    }
40    /// Optional per-column number formatting. If unset, the panel-level
41    /// default formatting is used.
42    #[inline]
43    pub fn number_format(&self) -> Option<&super::NumberFormat> {
44        self.number_format.as_ref().map(|o| &**o)
45    }
46}