Skip to main content

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

1/// Calculates the running sum of the area underneath a series using the trapezoidal rule.
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 IntegralSeries {
14    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
15    #[serde(rename = "input")]
16    input: Box<super::NumericSeries>,
17    #[builder(custom(type = super::TimestampConstant, convert = Box::new))]
18    #[serde(rename = "startTimestamp")]
19    start_timestamp: Box<super::TimestampConstant>,
20    #[builder(default, into)]
21    #[serde(rename = "timeUnit", skip_serializing_if = "Option::is_none", default)]
22    time_unit: Option<super::super::super::super::api::TimeUnit>,
23}
24impl IntegralSeries {
25    /// Constructs a new instance of the type.
26    #[inline]
27    pub fn new(
28        input: super::NumericSeries,
29        start_timestamp: super::TimestampConstant,
30    ) -> Self {
31        Self::builder().input(input).start_timestamp(start_timestamp).build()
32    }
33    #[inline]
34    pub fn input(&self) -> &super::NumericSeries {
35        &*self.input
36    }
37    #[inline]
38    pub fn start_timestamp(&self) -> &super::TimestampConstant {
39        &*self.start_timestamp
40    }
41    /// Time unit used to calculate the integral. Defaults to seconds if not specified.
42    #[inline]
43    pub fn time_unit(&self) -> Option<&super::super::super::super::api::TimeUnit> {
44        self.time_unit.as_ref().map(|o| &*o)
45    }
46}