Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
table_column.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 TableColumn {
13    #[serde(rename = "name")]
14    name: super::super::super::channelvariables::api::ChannelVariableName,
15    #[builder(
16        default,
17        custom(
18            type = impl
19            Into<Option<super::TableColumnTypedConfig>>,
20            convert = |v|v.into().map(Box::new)
21        )
22    )]
23    #[serde(rename = "typedConfig", skip_serializing_if = "Option::is_none", default)]
24    typed_config: Option<Box<super::TableColumnTypedConfig>>,
25    #[builder(default, into)]
26    #[serde(rename = "columnWidth", skip_serializing_if = "Option::is_none", default)]
27    #[derive_with(with = conjure_object::private::DoubleWrapper)]
28    column_width: Option<f64>,
29}
30impl TableColumn {
31    /// Constructs a new instance of the type.
32    #[inline]
33    pub fn new(
34        name: super::super::super::channelvariables::api::ChannelVariableName,
35    ) -> Self {
36        Self::builder().name(name).build()
37    }
38    #[inline]
39    pub fn name(
40        &self,
41    ) -> &super::super::super::channelvariables::api::ChannelVariableName {
42        &self.name
43    }
44    #[inline]
45    pub fn typed_config(&self) -> Option<&super::TableColumnTypedConfig> {
46        self.typed_config.as_ref().map(|o| &**o)
47    }
48    #[inline]
49    pub fn column_width(&self) -> Option<f64> {
50        self.column_width.as_ref().map(|o| *o)
51    }
52}