euv_core/vdom/enum.rs
1use super::*;
2
3/// A single diff operation that transforms one virtual-
4/// DOM list into another.
5///
6/// Operations are emitted in the order they should be
7/// applied. Indices refer to positions in the *current*
8/// list (after prior ops have been applied).
9#[derive(Clone, Debug, PartialEq)]
10pub enum DiffOp {
11 /// Insert a new node at the given index. The index is
12 /// the position in the new list.
13 Insert {
14 /// The target index in the new list.
15 index: usize,
16 /// The new node being inserted.
17 node: VirtualNode,
18 },
19 /// Remove the node at the given index from the old
20 /// list.
21 Remove {
22 /// The index of the node to remove.
23 index: usize,
24 },
25 /// Move the node currently at `from` to `to`.
26 Move {
27 /// The current index of the node.
28 from: usize,
29 /// The target index.
30 to: usize,
31 },
32 /// Patch the node at the given index in place (both
33 /// old and new lists reference the same node, so the
34 /// index is the same in both).
35 Update {
36 /// The index of the node to patch.
37 index: usize,
38 },
39}