1use crate::Property;
2
3#[derive(Clone, Debug, Default, PartialEq)]
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5pub struct Edit {
6 pub mode: EditMode,
7 pub binding: EditBinding,
8 pub value: Property,
9}
10
11#[derive(Copy, Clone, Debug, PartialEq, Eq)]
12#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
13pub enum EditBinding {
14 Strong,
15 Weak,
16 Same,
17}
18
19parse_enum! {
20 EditBinding,
21 (Strong, "strong"),
22 (Weak, "weak"),
23 (Same, "same"),
24}
25
26impl Default for EditBinding {
27 fn default() -> Self {
28 EditBinding::Weak
29 }
30}
31
32#[derive(Copy, Clone, Debug, PartialEq, Eq)]
33#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
34pub enum EditMode {
35 Assign,
36 AssignReplace,
37 Prepend,
38 PrependFirst,
39 Append,
40 AppendLast,
41 Delete,
42 DeleteAll,
43}
44
45parse_enum! {
46 EditMode,
47 (Assign, "assign"),
48 (AssignReplace, "assign_replace"),
49 (Prepend, "prepend"),
50 (PrependFirst, "prepend_first"),
51 (Append, "append"),
52 (AppendLast, "append_last"),
53 (Delete, "delete"),
54 (DeleteAll, "delete_all"),
55}
56
57impl Default for EditMode {
58 fn default() -> Self {
59 EditMode::Assign
60 }
61}
62