nominal_api/conjure/objects/scout/comparisonnotebook/api/
comparison_table_definition_v2.rs1#[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 ComparisonTableDefinitionV2 {
13 #[builder(default, into)]
14 #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
15 title: Option<String>,
16 #[builder(
17 default,
18 custom(
19 type = impl
20 Into<Option<super::RangeAggregationDefinition>>,
21 convert = |v|v.into().map(Box::new)
22 )
23 )]
24 #[serde(
25 rename = "rangeAggregation",
26 skip_serializing_if = "Option::is_none",
27 default
28 )]
29 range_aggregation: Option<Box<super::RangeAggregationDefinition>>,
30 #[builder(default, list(item(type = super::ComparisonTableColumn)))]
31 #[serde(rename = "columns", skip_serializing_if = "Vec::is_empty", default)]
32 columns: Vec<super::ComparisonTableColumn>,
33}
34impl ComparisonTableDefinitionV2 {
35 #[inline]
37 pub fn new() -> Self {
38 Self::builder().build()
39 }
40 #[inline]
41 pub fn title(&self) -> Option<&str> {
42 self.title.as_ref().map(|o| &**o)
43 }
44 #[inline]
45 pub fn range_aggregation(&self) -> Option<&super::RangeAggregationDefinition> {
46 self.range_aggregation.as_ref().map(|o| &**o)
47 }
48 #[inline]
49 pub fn columns(&self) -> &[super::ComparisonTableColumn] {
50 &*self.columns
51 }
52}