Skip to main content

nominal_api_conjure/conjure/objects/scout/compute/api/
range_duration_series.rs

1/// Outputs a numeric series with one point per range: timestamp = range start, value = range duration.
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 RangeDurationSeries {
14    #[builder(custom(type = super::RangeSeries, convert = Box::new))]
15    #[serde(rename = "input")]
16    input: Box<super::RangeSeries>,
17    #[builder(custom(type = super::UnboundedRangeBehavior, convert = Box::new))]
18    #[serde(rename = "unboundedRangeBehavior")]
19    unbounded_range_behavior: Box<super::UnboundedRangeBehavior>,
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 RangeDurationSeries {
25    /// Constructs a new instance of the type.
26    #[inline]
27    pub fn new(
28        input: super::RangeSeries,
29        unbounded_range_behavior: super::UnboundedRangeBehavior,
30    ) -> Self {
31        Self::builder()
32            .input(input)
33            .unbounded_range_behavior(unbounded_range_behavior)
34            .build()
35    }
36    #[inline]
37    pub fn input(&self) -> &super::RangeSeries {
38        &*self.input
39    }
40    /// How to handle ranges with a missing start or end.
41    #[inline]
42    pub fn unbounded_range_behavior(&self) -> &super::UnboundedRangeBehavior {
43        &*self.unbounded_range_behavior
44    }
45    /// The time unit of the duration. Defaults to seconds if not specified.
46    #[inline]
47    pub fn time_unit(&self) -> Option<&super::super::super::super::api::TimeUnit> {
48        self.time_unit.as_ref().map(|o| &*o)
49    }
50}