Skip to main content

nominal_api/conjure/objects/scout/checks/api/
checklist_ref.rs

1/// A reference to a checklist that may be pinned to a specific commit.
2/// If commit is empty, this refers to "the latest commit on main".
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash
13)]
14#[serde(crate = "conjure_object::serde")]
15#[conjure_object::private::staged_builder::staged_builder]
16#[builder(crate = conjure_object::private::staged_builder, update, inline)]
17pub struct ChecklistRef {
18    #[serde(rename = "rid")]
19    rid: super::super::super::rids::api::ChecklistRid,
20    #[builder(default, into)]
21    #[serde(rename = "commit", skip_serializing_if = "Option::is_none", default)]
22    commit: Option<super::super::super::versioning::api::CommitId>,
23}
24impl ChecklistRef {
25    /// Constructs a new instance of the type.
26    #[inline]
27    pub fn new(rid: super::super::super::rids::api::ChecklistRid) -> Self {
28        Self::builder().rid(rid).build()
29    }
30    #[inline]
31    pub fn rid(&self) -> &super::super::super::rids::api::ChecklistRid {
32        &self.rid
33    }
34    #[inline]
35    pub fn commit(&self) -> Option<&super::super::super::versioning::api::CommitId> {
36        self.commit.as_ref().map(|o| &*o)
37    }
38}