Skip to main content

nominal_api/conjure/objects/scout/layout/api/
canvas_panel.rs

1/// A standard workbook panel placed on a canvas.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct CanvasPanel {
14    #[builder(custom(type = super::CanvasRect, convert = Box::new))]
15    #[serde(rename = "rect")]
16    rect: Box<super::CanvasRect>,
17    #[builder(default, into)]
18    #[serde(rename = "hideLegend", skip_serializing_if = "Option::is_none", default)]
19    hide_legend: Option<bool>,
20}
21impl CanvasPanel {
22    /// Constructs a new instance of the type.
23    #[inline]
24    pub fn new(rect: super::CanvasRect) -> Self {
25        Self::builder().rect(rect).build()
26    }
27    #[inline]
28    pub fn rect(&self) -> &super::CanvasRect {
29        &*self.rect
30    }
31    #[inline]
32    pub fn hide_legend(&self) -> Option<bool> {
33        self.hide_legend.as_ref().map(|o| *o)
34    }
35}