Skip to main content

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

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct EnumResampleConfiguration {
16    #[builder(custom(type = super::DurationConstant, convert = Box::new))]
17    #[serde(rename = "interval")]
18    interval: Box<super::DurationConstant>,
19    #[builder(
20        default,
21        custom(
22            type = impl
23            Into<Option<super::EnumResampleInterpolationConfiguration>>,
24            convert = |v|v.into().map(Box::new)
25        )
26    )]
27    #[serde(rename = "interpolation", skip_serializing_if = "Option::is_none", default)]
28    interpolation: Option<Box<super::EnumResampleInterpolationConfiguration>>,
29}
30impl EnumResampleConfiguration {
31    /// Constructs a new instance of the type.
32    #[inline]
33    pub fn new(interval: super::DurationConstant) -> Self {
34        Self::builder().interval(interval).build()
35    }
36    /// Interval between resampled points
37    #[inline]
38    pub fn interval(&self) -> &super::DurationConstant {
39        &*self.interval
40    }
41    /// Interpolation strategy to use (defaults to forward fill).
42    #[inline]
43    pub fn interpolation(
44        &self,
45    ) -> Option<&super::EnumResampleInterpolationConfiguration> {
46        self.interpolation.as_ref().map(|o| &**o)
47    }
48}