Skip to main content

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

1/// Combines two boolean series point-wise using logical AND, producing true where both inputs are true and false otherwise.
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 AndSeries {
14    #[builder(custom(type = super::BooleanSeries, convert = Box::new))]
15    #[serde(rename = "left")]
16    left: Box<super::BooleanSeries>,
17    #[builder(custom(type = super::BooleanSeries, convert = Box::new))]
18    #[serde(rename = "right")]
19    right: Box<super::BooleanSeries>,
20    #[builder(
21        default,
22        custom(
23            type = impl
24            Into<Option<super::InterpolationConfiguration>>,
25            convert = |v|v.into().map(Box::new)
26        )
27    )]
28    #[serde(
29        rename = "interpolationConfiguration",
30        skip_serializing_if = "Option::is_none",
31        default
32    )]
33    interpolation_configuration: Option<Box<super::InterpolationConfiguration>>,
34}
35impl AndSeries {
36    /// Constructs a new instance of the type.
37    #[inline]
38    pub fn new(left: super::BooleanSeries, right: super::BooleanSeries) -> Self {
39        Self::builder().left(left).right(right).build()
40    }
41    #[inline]
42    pub fn left(&self) -> &super::BooleanSeries {
43        &*self.left
44    }
45    #[inline]
46    pub fn right(&self) -> &super::BooleanSeries {
47        &*self.right
48    }
49    /// Defaults to forward fill interpolation with a 1s interpolation radius
50    #[inline]
51    pub fn interpolation_configuration(
52        &self,
53    ) -> Option<&super::InterpolationConfiguration> {
54        self.interpolation_configuration.as_ref().map(|o| &**o)
55    }
56}