nominal_api/conjure/objects/scout/chartdefinition/api/
histogram_chart_definition_v1.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 HistogramChartDefinitionV1 {
13 #[builder(default, list(item(type = super::HistogramPlot)))]
14 #[serde(rename = "plots", skip_serializing_if = "Vec::is_empty", default)]
15 plots: Vec<super::HistogramPlot>,
16 #[builder(default, into)]
17 #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
18 title: Option<String>,
19 #[builder(custom(type = super::HistogramDisplaySettings, convert = Box::new))]
20 #[serde(rename = "displaySettings")]
21 display_settings: Box<super::HistogramDisplaySettings>,
22 #[builder(
23 default,
24 custom(
25 type = impl
26 Into<Option<super::super::super::compute::api::NumericHistogramBucketStrategy>>,
27 convert = |v|v.into().map(Box::new)
28 )
29 )]
30 #[serde(
31 rename = "numericBucketStrategy",
32 skip_serializing_if = "Option::is_none",
33 default
34 )]
35 numeric_bucket_strategy: Option<
36 Box<super::super::super::compute::api::NumericHistogramBucketStrategy>,
37 >,
38 #[builder(
39 default,
40 custom(
41 type = impl
42 Into<Option<super::ValueAxis>>,
43 convert = |v|v.into().map(Box::new)
44 )
45 )]
46 #[serde(rename = "valueAxis", skip_serializing_if = "Option::is_none", default)]
47 value_axis: Option<Box<super::ValueAxis>>,
48}
49impl HistogramChartDefinitionV1 {
50 #[inline]
52 pub fn new(display_settings: super::HistogramDisplaySettings) -> Self {
53 Self::builder().display_settings(display_settings).build()
54 }
55 #[inline]
56 pub fn plots(&self) -> &[super::HistogramPlot] {
57 &*self.plots
58 }
59 #[inline]
60 pub fn title(&self) -> Option<&str> {
61 self.title.as_ref().map(|o| &**o)
62 }
63 #[inline]
64 pub fn display_settings(&self) -> &super::HistogramDisplaySettings {
65 &*self.display_settings
66 }
67 #[inline]
68 pub fn numeric_bucket_strategy(
69 &self,
70 ) -> Option<&super::super::super::compute::api::NumericHistogramBucketStrategy> {
71 self.numeric_bucket_strategy.as_ref().map(|o| &**o)
72 }
73 #[inline]
74 pub fn value_axis(&self) -> Option<&super::ValueAxis> {
75 self.value_axis.as_ref().map(|o| &**o)
76 }
77}