Skip to main content

nominal_api/conjure/objects/scout/checks/api/
num_ranges_condition_v3.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 NumRangesConditionV3 {
13    #[builder(
14        custom(type = super::super::super::compute::api::RangeSeries, convert = Box::new)
15    )]
16    #[serde(rename = "ranges")]
17    ranges: Box<super::super::super::compute::api::RangeSeries>,
18    #[builder(
19        custom(
20            type = impl
21            conjure_object::serde::Serialize,
22            convert = |v|conjure_object::Any::new(v).expect("value failed to serialize")
23        )
24    )]
25    #[serde(rename = "functionSpec")]
26    function_spec: conjure_object::Any,
27    #[serde(rename = "threshold")]
28    threshold: i32,
29    #[serde(rename = "operator")]
30    operator: super::super::super::compute::api::ThresholdOperator,
31    #[builder(
32        default,
33        map(
34            key(type = super::super::super::compute::api::VariableName),
35            value(type = super::VariableLocator)
36        )
37    )]
38    #[serde(
39        rename = "variables",
40        skip_serializing_if = "std::collections::BTreeMap::is_empty",
41        default
42    )]
43    variables: std::collections::BTreeMap<
44        super::super::super::compute::api::VariableName,
45        super::VariableLocator,
46    >,
47    #[builder(default, into)]
48    #[serde(
49        rename = "functionVariables",
50        skip_serializing_if = "Option::is_none",
51        default
52    )]
53    function_variables: Option<
54        std::collections::BTreeMap<
55            super::super::super::compute::api::FunctionReference,
56            super::CheckContext,
57        >,
58    >,
59}
60impl NumRangesConditionV3 {
61    #[inline]
62    pub fn ranges(&self) -> &super::super::super::compute::api::RangeSeries {
63        &*self.ranges
64    }
65    #[inline]
66    pub fn function_spec(&self) -> &conjure_object::Any {
67        &self.function_spec
68    }
69    #[inline]
70    pub fn threshold(&self) -> i32 {
71        self.threshold
72    }
73    #[inline]
74    pub fn operator(&self) -> &super::super::super::compute::api::ThresholdOperator {
75        &self.operator
76    }
77    #[inline]
78    pub fn variables(
79        &self,
80    ) -> &std::collections::BTreeMap<
81        super::super::super::compute::api::VariableName,
82        super::VariableLocator,
83    > {
84        &self.variables
85    }
86    #[deprecated(
87        note = "This field is deprecated and will be removed in a future version.\n"
88    )]
89    #[inline]
90    pub fn function_variables(
91        &self,
92    ) -> Option<
93        &std::collections::BTreeMap<
94            super::super::super::compute::api::FunctionReference,
95            super::CheckContext,
96        >,
97    > {
98        self.function_variables.as_ref().map(|o| &*o)
99    }
100}