Skip to main content

nominal_api/conjure/objects/scout/compute/api/
select_series.rs

1/// Selects a specific series from a dataset (might contain multiple tag groupings).
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct SelectSeries {
14    #[builder(custom(type = super::StringConstant, convert = Box::new))]
15    #[serde(rename = "name")]
16    name: Box<super::StringConstant>,
17    #[builder(
18        default,
19        custom(
20            type = impl
21            Into<Option<super::Dataset>>,
22            convert = |v|v.into().map(Box::new)
23        )
24    )]
25    #[serde(rename = "dataset", skip_serializing_if = "Option::is_none", default)]
26    dataset: Option<Box<super::Dataset>>,
27    #[builder(
28        default,
29        custom(
30            type = impl
31            Into<Option<super::Dataset>>,
32            convert = |v|v.into().map(Box::new)
33        )
34    )]
35    #[serde(rename = "dataFrame", skip_serializing_if = "Option::is_none", default)]
36    data_frame: Option<Box<super::Dataset>>,
37}
38impl SelectSeries {
39    /// Constructs a new instance of the type.
40    #[inline]
41    pub fn new(name: super::StringConstant) -> Self {
42        Self::builder().name(name).build()
43    }
44    /// The identifying series name to query
45    #[inline]
46    pub fn name(&self) -> &super::StringConstant {
47        &*self.name
48    }
49    /// The dataset providing the data to query
50    #[inline]
51    pub fn dataset(&self) -> Option<&super::Dataset> {
52        self.dataset.as_ref().map(|o| &**o)
53    }
54    /// The data frame providing the data to query
55    #[deprecated(note = "use dataset instead.")]
56    #[inline]
57    pub fn data_frame(&self) -> Option<&super::Dataset> {
58        self.data_frame.as_ref().map(|o| &**o)
59    }
60}