Skip to main content

nominal_api_conjure/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    #[builder(
38        default,
39        custom(
40            type = impl
41            Into<Option<super::Sampling>>,
42            convert = |v|v.into().map(Box::new)
43        )
44    )]
45    #[serde(rename = "sampling", skip_serializing_if = "Option::is_none", default)]
46    sampling: Option<Box<super::Sampling>>,
47}
48impl SelectSeries {
49    /// Constructs a new instance of the type.
50    #[inline]
51    pub fn new(name: super::StringConstant) -> Self {
52        Self::builder().name(name).build()
53    }
54    /// The identifying series name to query
55    #[inline]
56    pub fn name(&self) -> &super::StringConstant {
57        &*self.name
58    }
59    /// The dataset providing the data to query. May be omitted inside a `WithSeriesDataset` series definition,
60    /// in which case it defaults to that node's wrapping `input`; required everywhere else.
61    #[inline]
62    pub fn dataset(&self) -> Option<&super::Dataset> {
63        self.dataset.as_ref().map(|o| &**o)
64    }
65    /// The data frame providing the data to query
66    #[deprecated(note = "use dataset instead.")]
67    #[inline]
68    pub fn data_frame(&self) -> Option<&super::Dataset> {
69        self.data_frame.as_ref().map(|o| &**o)
70    }
71    /// Raw-series sampling options. Currently supported only for numeric raw series.
72    #[inline]
73    pub fn sampling(&self) -> Option<&super::Sampling> {
74        self.sampling.as_ref().map(|o| &**o)
75    }
76}