Skip to main content

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

1/// Expands ranges durations by adding temporal padding to the start, end, or both sides. Note that if the input
2/// ranges contain a RangeValue, it will be dropped.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    conjure_object::private::DeriveWith
9)]
10#[serde(crate = "conjure_object::serde")]
11#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[conjure_object::private::staged_builder::staged_builder]
13#[builder(crate = conjure_object::private::staged_builder, update, inline)]
14pub struct PaddedRanges {
15    #[builder(custom(type = super::RangeSeries, convert = Box::new))]
16    #[serde(rename = "input")]
17    input: Box<super::RangeSeries>,
18    #[builder(custom(type = super::DurationConstant, convert = Box::new))]
19    #[serde(rename = "padding")]
20    padding: Box<super::DurationConstant>,
21    #[builder(default, into)]
22    #[serde(
23        rename = "paddingConfiguration",
24        skip_serializing_if = "Option::is_none",
25        default
26    )]
27    padding_configuration: Option<super::RangePaddingConfiguration>,
28}
29impl PaddedRanges {
30    /// Constructs a new instance of the type.
31    #[inline]
32    pub fn new(input: super::RangeSeries, padding: super::DurationConstant) -> Self {
33        Self::builder().input(input).padding(padding).build()
34    }
35    #[inline]
36    pub fn input(&self) -> &super::RangeSeries {
37        &*self.input
38    }
39    #[inline]
40    pub fn padding(&self) -> &super::DurationConstant {
41        &*self.padding
42    }
43    /// Configuration for how to apply padding to the ranges. Defaults to PAD_START_AND_END if not specified.
44    #[inline]
45    pub fn padding_configuration(&self) -> Option<&super::RangePaddingConfiguration> {
46        self.padding_configuration.as_ref().map(|o| &*o)
47    }
48}