nominal_api/conjure/objects/scout/chartdefinition/api/
line_threshold.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 LineThreshold {
13 #[serde(rename = "value")]
14 #[derive_with(with = conjure_object::private::DoubleWrapper)]
15 value: f64,
16 #[builder(default, into)]
17 #[serde(rename = "label", skip_serializing_if = "Option::is_none", default)]
18 label: Option<String>,
19 #[serde(rename = "color")]
20 color: super::super::super::api::HexColor,
21 #[serde(rename = "lineStyle")]
22 line_style: super::ThresholdLineStyle,
23}
24impl LineThreshold {
25 #[inline]
27 pub fn new(
28 value: f64,
29 color: super::super::super::api::HexColor,
30 line_style: super::ThresholdLineStyle,
31 ) -> Self {
32 Self::builder().value(value).color(color).line_style(line_style).build()
33 }
34 #[inline]
35 pub fn value(&self) -> f64 {
36 self.value
37 }
38 #[inline]
39 pub fn label(&self) -> Option<&str> {
40 self.label.as_ref().map(|o| &**o)
41 }
42 #[inline]
43 pub fn color(&self) -> &super::super::super::api::HexColor {
44 &self.color
45 }
46 #[inline]
47 pub fn line_style(&self) -> &super::ThresholdLineStyle {
48 &self.line_style
49 }
50}