Skip to main content

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

1/// The end represents the first timestamp that does not belong to the range. If absent, there is no known
2/// end to the range.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    conjure_object::private::DeriveWith
9)]
10#[serde(crate = "conjure_object::serde")]
11#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[conjure_object::private::staged_builder::staged_builder]
13#[builder(crate = conjure_object::private::staged_builder, update, inline)]
14pub struct Range {
15    #[builder(
16        default,
17        custom(
18            type = impl
19            Into<Option<super::super::super::super::api::Timestamp>>,
20            convert = |v|v.into().map(Box::new)
21        )
22    )]
23    #[serde(rename = "start", skip_serializing_if = "Option::is_none", default)]
24    start: Option<Box<super::super::super::super::api::Timestamp>>,
25    #[builder(
26        default,
27        custom(
28            type = impl
29            Into<Option<super::super::super::super::api::Timestamp>>,
30            convert = |v|v.into().map(Box::new)
31        )
32    )]
33    #[serde(rename = "end", skip_serializing_if = "Option::is_none", default)]
34    end: Option<Box<super::super::super::super::api::Timestamp>>,
35    #[builder(
36        default,
37        custom(
38            type = impl
39            Into<Option<super::RangeValue>>,
40            convert = |v|v.into().map(Box::new)
41        )
42    )]
43    #[serde(rename = "value", skip_serializing_if = "Option::is_none", default)]
44    value: Option<Box<super::RangeValue>>,
45}
46impl Range {
47    /// Constructs a new instance of the type.
48    #[inline]
49    pub fn new() -> Self {
50        Self::builder().build()
51    }
52    #[inline]
53    pub fn start(&self) -> Option<&super::super::super::super::api::Timestamp> {
54        self.start.as_ref().map(|o| &**o)
55    }
56    #[inline]
57    pub fn end(&self) -> Option<&super::super::super::super::api::Timestamp> {
58        self.end.as_ref().map(|o| &**o)
59    }
60    #[inline]
61    pub fn value(&self) -> Option<&super::RangeValue> {
62        self.value.as_ref().map(|o| &**o)
63    }
64}