Skip to main content

Module diff

Module diff 

Source
Expand description

The patches that bring one tree to another, by key.

A tree sent over super is diffed against the copy the window holds, and the patches alone are sent: a node kept by key keeps its widget, and with it focus, scroll position and text state. Keyed by Node::key, which is stable for as long as the node shows the same thing.

Both sides of the protocol use this: a tilolang view’s tree (crate::patch::Node) is diffed by the runtime, and so is a Rust app’s — a view is a function of a resource whichever language wrote it, and the window draws both the same way (one-app-model.md §2).

Functions§

at
The node at path (keys below the root) of node, when each key on the way names one child.
at_mut
The node at path (keys below the root) of node.
diff
The patches that bring old, the tree the window holds, to new, appended to out.
diff_at
The patches that bring old, the node at path of the tree the window holds, to new, appended to out; false, and nothing appended, when new is another node (another kind or key) or its children’s keys are not unique: then the tree is diffed whole.