tree_table/args/
args_borders.rs1use crate::SpanKey;
2use crate::statics::default_emit_event_for_api;
3use crate::statics::default_expand_for_api;
4use crate::statics::default_save_selection_for_api;
5use crate::statics::default_undo_for_api;
6use alloc::string::String;
7
8#[cfg_attr(feature = "tsify", derive(tsify::Tsify))]
9#[cfg_attr(feature = "tsify", tsify(from_wasm_abi))]
10#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
11#[derive(Debug, Clone, PartialEq)]
12pub struct BorderArgs {
13 pub size: Option<u8>,
14 pub bg: Option<String>, }
16
17#[cfg_attr(feature = "tsify", derive(tsify::Tsify))]
18#[cfg_attr(feature = "tsify", tsify(from_wasm_abi))]
19#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
20#[derive(Debug, Clone, PartialEq)]
21pub struct BordersArgs {
22 pub key: SpanKey,
23 pub top: Option<BorderArgs>, pub right: Option<BorderArgs>,
25 pub bottom: Option<BorderArgs>,
26 pub left: Option<BorderArgs>,
27 #[cfg_attr(feature = "serde", serde(default = "default_emit_event_for_api"))]
28 pub emit: bool,
29 #[cfg_attr(feature = "serde", serde(default = "default_undo_for_api"))]
30 pub undo: bool,
31 #[cfg_attr(feature = "serde", serde(default = "default_save_selection_for_api"))]
32 pub save_selection: bool,
33 #[cfg_attr(feature = "serde", serde(default = "default_expand_for_api"))]
34 pub expand: bool,
35}
36
37impl Default for BordersArgs {
38 fn default() -> Self {
39 BordersArgs {
40 key: SpanKey::None,
41 top: None,
42 right: None,
43 bottom: None,
44 left: None,
45 emit: default_emit_event_for_api(),
46 undo: default_undo_for_api(),
47 save_selection: default_save_selection_for_api(),
48 expand: default_expand_for_api(),
49 }
50 }
51}
52
53#[cfg_attr(feature = "tsify", derive(tsify::Tsify))]
55#[cfg_attr(feature = "tsify", tsify(from_wasm_abi))]
56#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
57#[derive(Debug, Clone, PartialEq)]
58pub struct SetBordersArgs {
59 pub key: SpanKey,
60 pub top: Option<Option<BorderArgs>>,
62 pub right: Option<Option<BorderArgs>>,
63 pub bottom: Option<Option<BorderArgs>>,
64 pub left: Option<Option<BorderArgs>>,
65 #[cfg_attr(feature = "serde", serde(default = "default_emit_event_for_api"))]
66 pub emit: bool,
67 #[cfg_attr(feature = "serde", serde(default = "default_undo_for_api"))]
68 pub undo: bool,
69 #[cfg_attr(feature = "serde", serde(default = "default_save_selection_for_api"))]
70 pub save_selection: bool,
71}
72
73impl Default for SetBordersArgs {
74 fn default() -> Self {
75 SetBordersArgs {
76 key: SpanKey::None,
77 top: None,
78 right: None,
79 bottom: None,
80 left: None,
81 emit: default_emit_event_for_api(),
82 undo: default_undo_for_api(),
83 save_selection: default_save_selection_for_api(),
84 }
85 }
86}