Skip to main content

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

1/// A literal range of values.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    PartialEq,
8    Eq,
9    PartialOrd,
10    Ord,
11    Hash
12)]
13#[serde(crate = "conjure_object::serde")]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct LiteralRange {
17    #[builder(
18        default,
19        custom(
20            type = impl
21            Into<Option<super::TimestampConstant>>,
22            convert = |v|v.into().map(Box::new)
23        )
24    )]
25    #[serde(rename = "startTimestamp", skip_serializing_if = "Option::is_none", default)]
26    start_timestamp: Option<Box<super::TimestampConstant>>,
27    #[builder(
28        default,
29        custom(
30            type = impl
31            Into<Option<super::TimestampConstant>>,
32            convert = |v|v.into().map(Box::new)
33        )
34    )]
35    #[serde(rename = "endTimestamp", skip_serializing_if = "Option::is_none", default)]
36    end_timestamp: Option<Box<super::TimestampConstant>>,
37    #[builder(default, into)]
38    #[serde(rename = "tags", skip_serializing_if = "Option::is_none", default)]
39    tags: Option<std::collections::BTreeMap<String, String>>,
40}
41impl LiteralRange {
42    /// Constructs a new instance of the type.
43    #[inline]
44    pub fn new() -> Self {
45        Self::builder().build()
46    }
47    #[inline]
48    pub fn start_timestamp(&self) -> Option<&super::TimestampConstant> {
49        self.start_timestamp.as_ref().map(|o| &**o)
50    }
51    #[inline]
52    pub fn end_timestamp(&self) -> Option<&super::TimestampConstant> {
53        self.end_timestamp.as_ref().map(|o| &**o)
54    }
55    #[inline]
56    pub fn tags(&self) -> Option<&std::collections::BTreeMap<String, String>> {
57        self.tags.as_ref().map(|o| &*o)
58    }
59}