Skip to main content

nominal_api/conjure/objects/scout/compute/resolved/api/
thresholding_ranges_node.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 ThresholdingRangesNode {
13    #[builder(custom(type = super::NumericSeriesNode, convert = Box::new))]
14    #[serde(rename = "input")]
15    input: Box<super::NumericSeriesNode>,
16    #[serde(rename = "threshold")]
17    #[derive_with(with = conjure_object::private::DoubleWrapper)]
18    threshold: f64,
19    #[serde(rename = "operator")]
20    operator: super::super::super::api::ThresholdOperator,
21    #[builder(
22        default,
23        custom(
24            type = impl
25            Into<Option<super::PersistenceWindowConfiguration>>,
26            convert = |v|v.into().map(Box::new)
27        )
28    )]
29    #[serde(
30        rename = "persistenceWindowConfiguration",
31        skip_serializing_if = "Option::is_none",
32        default
33    )]
34    persistence_window_configuration: Option<Box<super::PersistenceWindowConfiguration>>,
35}
36impl ThresholdingRangesNode {
37    /// Constructs a new instance of the type.
38    #[inline]
39    pub fn new(
40        input: super::NumericSeriesNode,
41        threshold: f64,
42        operator: super::super::super::api::ThresholdOperator,
43    ) -> Self {
44        Self::builder().input(input).threshold(threshold).operator(operator).build()
45    }
46    #[inline]
47    pub fn input(&self) -> &super::NumericSeriesNode {
48        &*self.input
49    }
50    #[inline]
51    pub fn threshold(&self) -> f64 {
52        self.threshold
53    }
54    #[inline]
55    pub fn operator(&self) -> &super::super::super::api::ThresholdOperator {
56        &self.operator
57    }
58    #[inline]
59    pub fn persistence_window_configuration(
60        &self,
61    ) -> Option<&super::PersistenceWindowConfiguration> {
62        self.persistence_window_configuration.as_ref().map(|o| &**o)
63    }
64}