Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
floating_legend_config.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct FloatingLegendConfig {
16    #[builder(default, into)]
17    #[serde(rename = "hidden", skip_serializing_if = "Option::is_none", default)]
18    hidden: Option<bool>,
19    #[builder(custom(type = super::FloatingLegend, convert = Box::new))]
20    #[serde(rename = "legend")]
21    legend: Box<super::FloatingLegend>,
22}
23impl FloatingLegendConfig {
24    /// Constructs a new instance of the type.
25    #[inline]
26    pub fn new(legend: super::FloatingLegend) -> Self {
27        Self::builder().legend(legend).build()
28    }
29    /// Whether to hide the floating legend. Defaults to false.
30    #[inline]
31    pub fn hidden(&self) -> Option<bool> {
32        self.hidden.as_ref().map(|o| *o)
33    }
34    #[inline]
35    pub fn legend(&self) -> &super::FloatingLegend {
36        &*self.legend
37    }
38}