Skip to main content

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

1/// Outputs a new series where each value is the difference between the time of the current and previous points.
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 TimeDifferenceSeries {
14    #[builder(custom(type = super::Series, convert = Box::new))]
15    #[serde(rename = "input")]
16    input: Box<super::Series>,
17    #[builder(default, into)]
18    #[serde(rename = "timeUnit", skip_serializing_if = "Option::is_none", default)]
19    time_unit: Option<super::super::super::super::api::TimeUnit>,
20}
21impl TimeDifferenceSeries {
22    /// Constructs a new instance of the type.
23    #[inline]
24    pub fn new(input: super::Series) -> Self {
25        Self::builder().input(input).build()
26    }
27    #[inline]
28    pub fn input(&self) -> &super::Series {
29        &*self.input
30    }
31    /// The time unit used to define the output values. Defaults to seconds if not specified.
32    #[inline]
33    pub fn time_unit(&self) -> Option<&super::super::super::super::api::TimeUnit> {
34        self.time_unit.as_ref().map(|o| &*o)
35    }
36}