Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
value_table_definition_v1.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 ValueTableDefinitionV1 {
13    #[builder(default, into)]
14    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
15    title: Option<String>,
16    #[builder(default, list(item(type = super::ValueTableChannel)))]
17    #[serde(rename = "channels", skip_serializing_if = "Vec::is_empty", default)]
18    channels: Vec<super::ValueTableChannel>,
19}
20impl ValueTableDefinitionV1 {
21    /// Constructs a new instance of the type.
22    #[inline]
23    pub fn new() -> Self {
24        Self::builder().build()
25    }
26    #[inline]
27    pub fn title(&self) -> Option<&str> {
28        self.title.as_ref().map(|o| &**o)
29    }
30    /// Each channel to be displayed. Based on the data type, the visualisation
31    /// options and settings will be different.
32    #[inline]
33    pub fn channels(&self) -> &[super::ValueTableChannel] {
34        &*self.channels
35    }
36}