Skip to main content

nominal_api/conjure/objects/scout/workbookcommon/api/
workbook_input.rs

1/// A workbook input is a value managed at the workbook level
2/// that can be applied to multiple elements.
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 WorkbookInput {
18    #[serde(rename = "id")]
19    id: conjure_object::Uuid,
20    #[builder(default, into)]
21    #[serde(rename = "label", skip_serializing_if = "Option::is_none", default)]
22    label: Option<String>,
23    #[builder(custom(type = super::InputType, convert = Box::new))]
24    #[serde(rename = "value")]
25    value: Box<super::InputType>,
26}
27impl WorkbookInput {
28    /// Constructs a new instance of the type.
29    #[inline]
30    pub fn new(id: conjure_object::Uuid, value: super::InputType) -> Self {
31        Self::builder().id(id).value(value).build()
32    }
33    /// The unique identifier of the input.
34    #[inline]
35    pub fn id(&self) -> conjure_object::Uuid {
36        self.id
37    }
38    /// The label of the input for display purposes.
39    #[inline]
40    pub fn label(&self) -> Option<&str> {
41        self.label.as_ref().map(|o| &**o)
42    }
43    #[inline]
44    pub fn value(&self) -> &super::InputType {
45        &*self.value
46    }
47}