pub enum Change {
SetAttr {
path: Vec<usize>,
key: String,
value: Value,
},
RemoveAttr {
path: Vec<usize>,
key: String,
},
SetText {
path: Vec<usize>,
text: Option<String>,
},
SetMarks {
path: Vec<usize>,
marks: Option<Vec<Mark>>,
},
SetExtra {
path: Vec<usize>,
key: String,
value: Value,
},
RemoveExtra {
path: Vec<usize>,
key: String,
},
Insert {
path: Vec<usize>,
index: usize,
node: Node,
},
Remove {
path: Vec<usize>,
index: usize,
},
Replace {
path: Vec<usize>,
node: Node,
},
Move {
path: Vec<usize>,
from: usize,
to: usize,
},
}Expand description
A single structural change between two Node trees.
Serializes as a tagged object, e.g. {"op":"setText","path":[0,0],"text":"hi"}.
Variants§
SetAttr
Set (insert or overwrite) attribute key on the node at path.
Fields
RemoveAttr
Remove attribute key from the node at path.
SetText
Set the text payload of the node at path (None clears it).
Fields
SetMarks
Replace the whole mark list of the node at path (None clears it).
Fields
SetExtra
Set (insert or overwrite) unknown top-level field key on the node at path.
Fields
RemoveExtra
Remove unknown top-level field key from the node at path.
Insert
Insert node as a child of the node at path (the parent), at index.
Fields
Remove
Remove the child at index of the node at path (the parent).
Replace
Replace the node at path wholesale (used when its type changes).
Fields
Move
Relocate a child within the same parent’s list, without cloning its
subtree. from/to are interpreted against the live list: the child
at from is removed first, then re-inserted so it lands at index to
in the post-removal list — observationally Remove{from} + Insert{to},
so it composes with the same live-index cursor model as the other ops.