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,
},
}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).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Change
impl<'de> Deserialize<'de> for Change
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Change
Auto Trait Implementations§
impl Freeze for Change
impl RefUnwindSafe for Change
impl Send for Change
impl Sync for Change
impl Unpin for Change
impl UnsafeUnpin for Change
impl UnwindSafe for Change
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more