Skip to content

enum

Patch

pub enum Patch {
    Replace { path: Vec<usize>, node: VNode },
    SetText { path: Vec<usize>, text: String },
    SetAttr { path: Vec<usize>, name: String, value: Value },
    RemoveAttr { path: Vec<usize>, name: String },
    SetEvents { path: Vec<usize>, events: Vec<EventHandler> },
    Append { path: Vec<usize>, node: VNode },
    Truncate { path: Vec<usize>, len: usize },
}

A single change. Paths index from the root list; Append/Truncate paths name the parent (empty = root list).

Variants

Replace

Replace { path: Vec<usize>, node: VNode }

Replace the node at path with node.

SetText

SetText { path: Vec<usize>, text: String }

Set the text of the text node at path.

SetAttr

SetAttr { path: Vec<usize>, name: String, value: Value }

Set an attribute on the element at path.

RemoveAttr

RemoveAttr { path: Vec<usize>, name: String }

Remove an attribute from the element at path.

SetEvents

SetEvents { path: Vec<usize>, events: Vec<EventHandler> }

Replace the event handlers of the element at path.

Append

Append { path: Vec<usize>, node: VNode }

Add node as the last child of path.

Truncate

Truncate { path: Vec<usize>, len: usize }

Remove children of path from index len on.

Methods

path

pub fn path(&self) -> &[usize]

The position in the tree the patch applies to: child indexes from the root.

Trait implementations