Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
time_series_row.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 TimeSeriesRow {
13    #[builder(default, into)]
14    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
15    title: Option<String>,
16    #[builder(default, list(item(type = super::TimeSeriesPlot)))]
17    #[serde(rename = "plots", skip_serializing_if = "Vec::is_empty", default)]
18    plots: Vec<super::TimeSeriesPlot>,
19    #[builder(default, into)]
20    #[serde(rename = "plotsV2", skip_serializing_if = "Option::is_none", default)]
21    plots_v2: Option<Vec<super::TimeSeriesPlotV2>>,
22    #[serde(rename = "rowFlexSize")]
23    #[derive_with(with = conjure_object::private::DoubleWrapper)]
24    row_flex_size: f64,
25    #[builder(default, into)]
26    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none", default)]
27    enabled: Option<bool>,
28}
29impl TimeSeriesRow {
30    /// Constructs a new instance of the type.
31    #[inline]
32    pub fn new(row_flex_size: f64) -> Self {
33        Self::builder().row_flex_size(row_flex_size).build()
34    }
35    #[inline]
36    pub fn title(&self) -> Option<&str> {
37        self.title.as_ref().map(|o| &**o)
38    }
39    #[inline]
40    pub fn plots(&self) -> &[super::TimeSeriesPlot] {
41        &*self.plots
42    }
43    #[inline]
44    pub fn plots_v2(&self) -> Option<&[super::TimeSeriesPlotV2]> {
45        self.plots_v2.as_ref().map(|o| &**o)
46    }
47    #[inline]
48    pub fn row_flex_size(&self) -> f64 {
49        self.row_flex_size
50    }
51    #[inline]
52    pub fn enabled(&self) -> Option<bool> {
53        self.enabled.as_ref().map(|o| *o)
54    }
55}