Skip to main content

nominal_api/conjure/objects/scout/checks/api/
num_ranges_condition_v1.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 NumRangesConditionV1 {
13    #[builder(
14        custom(
15            type = super::super::super::compute::api::deprecated::RangesNode,
16            convert = Box::new
17        )
18    )]
19    #[serde(rename = "ranges")]
20    ranges: Box<super::super::super::compute::api::deprecated::RangesNode>,
21    #[builder(
22        custom(
23            type = impl
24            conjure_object::serde::Serialize,
25            convert = |v|conjure_object::Any::new(v).expect("value failed to serialize")
26        )
27    )]
28    #[serde(rename = "functionSpec")]
29    function_spec: conjure_object::Any,
30    #[serde(rename = "threshold")]
31    threshold: i32,
32    #[serde(rename = "operator")]
33    operator: super::super::super::compute::api::ThresholdOperator,
34    #[builder(
35        default,
36        map(
37            key(type = super::super::super::compute::api::VariableName),
38            value(type = super::super::super::api::ChannelLocator)
39        )
40    )]
41    #[serde(
42        rename = "variables",
43        skip_serializing_if = "std::collections::BTreeMap::is_empty",
44        default
45    )]
46    variables: std::collections::BTreeMap<
47        super::super::super::compute::api::VariableName,
48        super::super::super::api::ChannelLocator,
49    >,
50}
51impl NumRangesConditionV1 {
52    #[inline]
53    pub fn ranges(&self) -> &super::super::super::compute::api::deprecated::RangesNode {
54        &*self.ranges
55    }
56    #[inline]
57    pub fn function_spec(&self) -> &conjure_object::Any {
58        &self.function_spec
59    }
60    #[inline]
61    pub fn threshold(&self) -> i32 {
62        self.threshold
63    }
64    #[inline]
65    pub fn operator(&self) -> &super::super::super::compute::api::ThresholdOperator {
66        &self.operator
67    }
68    #[inline]
69    pub fn variables(
70        &self,
71    ) -> &std::collections::BTreeMap<
72        super::super::super::compute::api::VariableName,
73        super::super::super::api::ChannelLocator,
74    > {
75        &self.variables
76    }
77}