Skip to main content

lichtung_plot/builder/
text_clear.rs

1//! Remove local slot instructions without replacing content or its presence.
2
3use super::Plot;
4
5macro_rules! clear_slot {
6    ($style:ident, $layout:ident, $field:ident, [$($access:tt)+] $(, $bound:ident)?) => {
7        impl<K: crate::kind::Marker> Plot<K> {
8            #[doc = concat!("Remove the local `", stringify!($field), "` appearance override; retain content/layout and inherit the effective Theme role.")]
9            #[must_use]
10            pub fn $style(mut self) -> Self $(where K: crate::kind::$bound)? {
11                self.$($access)+.edit_clear_style();
12                self
13            }
14            #[doc = concat!("Remove the local `", stringify!($field), "` layout request; retain content/style and restore owner inheritance.")]
15            #[must_use]
16            pub fn $layout(mut self) -> Self $(where K: crate::kind::$bound)? {
17                self.$($access)+.edit_clear_layout();
18                self
19            }
20        }
21    };
22}
23
24clear_slot!(
25    clear_title_style,
26    clear_title_layout,
27    title,
28    [description.title]
29);
30clear_slot!(
31    clear_subtitle_style,
32    clear_subtitle_layout,
33    subtitle,
34    [description.subtitle]
35);
36clear_slot!(
37    clear_caption_style,
38    clear_caption_layout,
39    caption,
40    [description.payload_mut().caption]
41);
42clear_slot!(
43    clear_x_label_style,
44    clear_x_label_layout,
45    x_label,
46    [description.payload_mut().x_label]
47);
48clear_slot!(
49    clear_y_label_style,
50    clear_y_label_layout,
51    y_label,
52    [description.payload_mut().y_label]
53);
54clear_slot!(
55    clear_color_label_style,
56    clear_color_label_layout,
57    color_label,
58    [description.payload_mut().color_label],
59    ContinuousColor
60);
61
62impl Plot<crate::kind::Raincloud> {
63    /// Remove local hue-title appearance; retain content/layout and inherit the guide role.
64    #[must_use]
65    pub fn clear_hue_label_style(mut self) -> Self {
66        self.description
67            .payload_mut()
68            .raincloud_hue_label
69            .edit_clear_style();
70        self
71    }
72
73    /// Remove the local hue-title layout request; retain content/style and inherit the guide role.
74    #[must_use]
75    pub fn clear_hue_label_layout(mut self) -> Self {
76        self.description
77            .payload_mut()
78            .raincloud_hue_label
79            .edit_clear_layout();
80        self
81    }
82}