Skip to main content

nominal_api/conjure/objects/scout/compute/api/
timestamp_and_id.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 TimestampAndId {
16    #[builder(
17        custom(type = super::super::super::super::api::Timestamp, convert = Box::new)
18    )]
19    #[serde(rename = "timestamp")]
20    timestamp: Box<super::super::super::super::api::Timestamp>,
21    #[builder(default, into)]
22    #[serde(rename = "id", skip_serializing_if = "Option::is_none", default)]
23    id: Option<conjure_object::Uuid>,
24}
25impl TimestampAndId {
26    /// Constructs a new instance of the type.
27    #[inline]
28    pub fn new(timestamp: super::super::super::super::api::Timestamp) -> Self {
29        Self::builder().timestamp(timestamp).build()
30    }
31    #[inline]
32    pub fn timestamp(&self) -> &super::super::super::super::api::Timestamp {
33        &*self.timestamp
34    }
35    #[inline]
36    pub fn id(&self) -> Option<conjure_object::Uuid> {
37        self.id.as_ref().map(|o| *o)
38    }
39}