Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
value_table_definition_v2.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 ValueTableDefinitionV2 {
13    #[builder(default, into)]
14    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
15    title: Option<String>,
16    #[builder(default, into)]
17    #[serde(rename = "showUnits", skip_serializing_if = "Option::is_none", default)]
18    show_units: Option<bool>,
19    #[builder(default, into)]
20    #[serde(
21        rename = "showStalenessIndicator",
22        skip_serializing_if = "Option::is_none",
23        default
24    )]
25    show_staleness_indicator: Option<bool>,
26    #[builder(custom(type = super::ValueTableLayout, convert = Box::new))]
27    #[serde(rename = "layout")]
28    layout: Box<super::ValueTableLayout>,
29    #[builder(
30        default,
31        custom(
32            type = impl
33            Into<Option<super::ValueTableStalenessConfig>>,
34            convert = |v|v.into().map(Box::new)
35        )
36    )]
37    #[serde(
38        rename = "stalenessIndicator",
39        skip_serializing_if = "Option::is_none",
40        default
41    )]
42    staleness_indicator: Option<Box<super::ValueTableStalenessConfig>>,
43}
44impl ValueTableDefinitionV2 {
45    /// Constructs a new instance of the type.
46    #[inline]
47    pub fn new(layout: super::ValueTableLayout) -> Self {
48        Self::builder().layout(layout).build()
49    }
50    /// The display title of the panel.
51    #[inline]
52    pub fn title(&self) -> Option<&str> {
53        self.title.as_ref().map(|o| &**o)
54    }
55    /// If true, display units in the cells when available.
56    #[inline]
57    pub fn show_units(&self) -> Option<bool> {
58        self.show_units.as_ref().map(|o| *o)
59    }
60    /// If true, display staleness indicator in the cells when available.
61    #[inline]
62    pub fn show_staleness_indicator(&self) -> Option<bool> {
63        self.show_staleness_indicator.as_ref().map(|o| *o)
64    }
65    #[inline]
66    pub fn layout(&self) -> &super::ValueTableLayout {
67        &*self.layout
68    }
69    /// Configuration for showing staleness of values in the value table while streaming.
70    #[inline]
71    pub fn staleness_indicator(&self) -> Option<&super::ValueTableStalenessConfig> {
72        self.staleness_indicator.as_ref().map(|o| &**o)
73    }
74}