Skip to main content

tree_table/args/
args_highlight.rs

1use 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 HighlightArgs {
13    pub key: SpanKey,
14    pub bg: Option<String>,
15    pub fg: Option<String>,
16    #[cfg_attr(feature = "serde", serde(default = "default_emit_event_for_api"))]
17    pub emit: bool,
18    #[cfg_attr(feature = "serde", serde(default = "default_undo_for_api"))]
19    pub undo: bool,
20    #[cfg_attr(feature = "serde", serde(default = "default_save_selection_for_api"))]
21    pub save_selection: bool,
22    #[cfg_attr(feature = "serde", serde(default = "default_expand_for_api"))]
23    pub expand: bool,
24}
25
26impl Default for HighlightArgs {
27    fn default() -> Self {
28        HighlightArgs {
29            key: SpanKey::None,
30            bg: None,
31            fg: None,
32            emit: default_emit_event_for_api(),
33            undo: default_undo_for_api(),
34            save_selection: default_save_selection_for_api(),
35            expand: default_expand_for_api(),
36        }
37    }
38}