Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
numeric_cell_config.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct NumericCellConfig {
13    #[builder(
14        default,
15        custom(
16            type = impl
17            Into<Option<super::NumericValueVisualisationV2>>,
18            convert = |v|v.into().map(Box::new)
19        )
20    )]
21    #[serde(rename = "visualisation", skip_serializing_if = "Option::is_none", default)]
22    visualisation: Option<Box<super::NumericValueVisualisationV2>>,
23    #[builder(
24        default,
25        custom(
26            type = impl
27            Into<Option<super::NumberFormat>>,
28            convert = |v|v.into().map(Box::new)
29        )
30    )]
31    #[serde(rename = "numberFormat", skip_serializing_if = "Option::is_none", default)]
32    number_format: Option<Box<super::NumberFormat>>,
33    #[builder(
34        default,
35        custom(
36            type = impl
37            Into<Option<super::NumericGroupBySort>>,
38            convert = |v|v.into().map(Box::new)
39        )
40    )]
41    #[serde(rename = "groupBySort", skip_serializing_if = "Option::is_none", default)]
42    group_by_sort: Option<Box<super::NumericGroupBySort>>,
43}
44impl NumericCellConfig {
45    /// Constructs a new instance of the type.
46    #[inline]
47    pub fn new() -> Self {
48        Self::builder().build()
49    }
50    #[inline]
51    pub fn visualisation(&self) -> Option<&super::NumericValueVisualisationV2> {
52        self.visualisation.as_ref().map(|o| &**o)
53    }
54    #[inline]
55    pub fn number_format(&self) -> Option<&super::NumberFormat> {
56        self.number_format.as_ref().map(|o| &**o)
57    }
58    /// Sorting configuration for grouped data rendering in a cell.
59    /// If undefined, will sort alphabetically by grouping.
60    #[inline]
61    pub fn group_by_sort(&self) -> Option<&super::NumericGroupBySort> {
62        self.group_by_sort.as_ref().map(|o| &**o)
63    }
64}