Skip to main content

nominal_api/conjure/objects/scout/comparisonnotebook/api/
timestamped_range.rs

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