Skip to main content

nominal_api/conjure/objects/scout/compute/resolved/api/
extrema_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 ExtremaRangesNode {
13    #[builder(custom(type = super::NumericSeriesNode, convert = Box::new))]
14    #[serde(rename = "input")]
15    input: Box<super::NumericSeriesNode>,
16    #[serde(rename = "returnsPeaks")]
17    returns_peaks: bool,
18    #[builder(default, into)]
19    #[serde(
20        rename = "minimumProminence",
21        skip_serializing_if = "Option::is_none",
22        default
23    )]
24    #[derive_with(with = conjure_object::private::DoubleWrapper)]
25    minimum_prominence: Option<f64>,
26}
27impl ExtremaRangesNode {
28    /// Constructs a new instance of the type.
29    #[inline]
30    pub fn new(input: super::NumericSeriesNode, returns_peaks: bool) -> Self {
31        Self::builder().input(input).returns_peaks(returns_peaks).build()
32    }
33    #[inline]
34    pub fn input(&self) -> &super::NumericSeriesNode {
35        &*self.input
36    }
37    #[inline]
38    pub fn returns_peaks(&self) -> bool {
39        self.returns_peaks
40    }
41    #[inline]
42    pub fn minimum_prominence(&self) -> Option<f64> {
43        self.minimum_prominence.as_ref().map(|o| *o)
44    }
45}