Skip to main content

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

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