#[derive(
Debug,
Clone,
conjure_object::serde::Serialize,
conjure_object::serde::Deserialize,
conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct ChannelVariable {
#[builder(default, into)]
#[serde(rename = "displayName", skip_serializing_if = "Option::is_none", default)]
display_name: Option<String>,
#[serde(rename = "variableName")]
variable_name: super::ChannelVariableName,
#[builder(custom(type = super::ComputeSpec, convert = Box::new))]
#[serde(rename = "computeSpec")]
compute_spec: Box<super::ComputeSpec>,
#[builder(
default,
custom(
type = impl
Into<Option<super::ComputeNodeWithContext>>,
convert = |v|v.into().map(Box::new)
)
)]
#[serde(rename = "computeSpecV2", skip_serializing_if = "Option::is_none", default)]
compute_spec_v2: Option<Box<super::ComputeNodeWithContext>>,
}
impl ChannelVariable {
#[inline]
pub fn new(
variable_name: super::ChannelVariableName,
compute_spec: super::ComputeSpec,
) -> Self {
Self::builder().variable_name(variable_name).compute_spec(compute_spec).build()
}
#[inline]
pub fn display_name(&self) -> Option<&str> {
self.display_name.as_ref().map(|o| &**o)
}
#[inline]
pub fn variable_name(&self) -> &super::ChannelVariableName {
&self.variable_name
}
#[inline]
pub fn compute_spec(&self) -> &super::ComputeSpec {
&*self.compute_spec
}
#[inline]
pub fn compute_spec_v2(&self) -> Option<&super::ComputeNodeWithContext> {
self.compute_spec_v2.as_ref().map(|o| &**o)
}
}