nominal_api_conjure/conjure/objects/api/
numeric_property_range_predicate.rs1#[derive(
9 Debug,
10 Clone,
11 conjure_object::serde::Serialize,
12 conjure_object::serde::Deserialize,
13 conjure_object::private::DeriveWith
14)]
15#[serde(crate = "conjure_object::serde")]
16#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
17#[conjure_object::private::staged_builder::staged_builder]
18#[builder(crate = conjure_object::private::staged_builder, update, inline)]
19pub struct NumericPropertyRangePredicate {
20 #[serde(rename = "name")]
21 name: super::PropertyName,
22 #[builder(default, into)]
23 #[serde(rename = "min", skip_serializing_if = "Option::is_none", default)]
24 #[derive_with(with = conjure_object::private::DoubleWrapper)]
25 min: Option<f64>,
26 #[builder(default, into)]
27 #[serde(rename = "max", skip_serializing_if = "Option::is_none", default)]
28 #[derive_with(with = conjure_object::private::DoubleWrapper)]
29 max: Option<f64>,
30 #[serde(rename = "operator")]
31 operator: super::NumericPropertyRangeOperator,
32}
33impl NumericPropertyRangePredicate {
34 #[inline]
36 pub fn new(
37 name: super::PropertyName,
38 operator: super::NumericPropertyRangeOperator,
39 ) -> Self {
40 Self::builder().name(name).operator(operator).build()
41 }
42 #[inline]
43 pub fn name(&self) -> &super::PropertyName {
44 &self.name
45 }
46 #[inline]
47 pub fn min(&self) -> Option<f64> {
48 self.min.as_ref().map(|o| *o)
49 }
50 #[inline]
51 pub fn max(&self) -> Option<f64> {
52 self.max.as_ref().map(|o| *o)
53 }
54 #[inline]
55 pub fn operator(&self) -> &super::NumericPropertyRangeOperator {
56 &self.operator
57 }
58}