Skip to main content

nominal_api/conjure/objects/scout/compute/api/
numeric_resample_configuration.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 NumericResampleConfiguration {
13    #[builder(custom(type = super::DurationConstant, convert = Box::new))]
14    #[serde(rename = "interval")]
15    interval: Box<super::DurationConstant>,
16    #[builder(
17        default,
18        custom(
19            type = impl
20            Into<Option<super::NumericResampleInterpolationConfiguration>>,
21            convert = |v|v.into().map(Box::new)
22        )
23    )]
24    #[serde(rename = "interpolation", skip_serializing_if = "Option::is_none", default)]
25    interpolation: Option<Box<super::NumericResampleInterpolationConfiguration>>,
26}
27impl NumericResampleConfiguration {
28    /// Constructs a new instance of the type.
29    #[inline]
30    pub fn new(interval: super::DurationConstant) -> Self {
31        Self::builder().interval(interval).build()
32    }
33    /// Interval between resampled points
34    #[inline]
35    pub fn interval(&self) -> &super::DurationConstant {
36        &*self.interval
37    }
38    /// Interpolation strategy to use (defaults to forward fill).
39    #[inline]
40    pub fn interpolation(
41        &self,
42    ) -> Option<&super::NumericResampleInterpolationConfiguration> {
43        self.interpolation.as_ref().map(|o| &**o)
44    }
45}