Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
staleness_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 StalenessCellConfig {
13    #[builder(
14        default,
15        custom(
16            type = impl
17            Into<Option<super::StalenessVisualisation>>,
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::StalenessVisualisation>>,
23    #[builder(
24        default,
25        custom(
26            type = impl
27            Into<Option<super::NumericGroupBySort>>,
28            convert = |v|v.into().map(Box::new)
29        )
30    )]
31    #[serde(rename = "groupBySort", skip_serializing_if = "Option::is_none", default)]
32    group_by_sort: Option<Box<super::NumericGroupBySort>>,
33}
34impl StalenessCellConfig {
35    /// Constructs a new instance of the type.
36    #[inline]
37    pub fn new() -> Self {
38        Self::builder().build()
39    }
40    #[inline]
41    pub fn visualisation(&self) -> Option<&super::StalenessVisualisation> {
42        self.visualisation.as_ref().map(|o| &**o)
43    }
44    /// Sorting configuration for grouped data rendering in a cell.
45    /// If undefined, will sort alphabetically by grouping.
46    #[inline]
47    pub fn group_by_sort(&self) -> Option<&super::NumericGroupBySort> {
48        self.group_by_sort.as_ref().map(|o| &**o)
49    }
50}