Skip to main content

blockworx/document/
decorations.rs

1use crate::document::BlockLabel;
2
3/// Per-block label state, grouped so future decorations can live alongside the
4/// title and type. Both fields are [`BlockLabel`]s: `title.name` is the single
5/// source of truth for the block's name; `type_label` is its type (a second
6/// user-editable label, upper-left). An empty label's `name` simply isn't drawn.
7#[derive(Clone, PartialEq, Debug)]
8pub struct Decorations {
9    pub title: BlockLabel,
10    /// Named `type_label` since `type` is a keyword.
11    pub type_label: BlockLabel,
12}
13
14impl Default for Decorations {
15    fn default() -> Self {
16        Self {
17            title: BlockLabel::default(),
18            type_label: BlockLabel::upper_left(),
19        }
20    }
21}