Expand description
Structural diff of two Html values — the producer half of “the browser is
fold(apply_patch, initial_html, patch_stream)”.
Which side produces the ops is the mode: in Mode A the server diffs two renderings and streams
them; in Mode B the browser renders locally and diffs its own two renderings (crate::render).
It is the same function either way, which is why it lives here rather than in the runtime.
Properties this implementation holds, because the whole Mode A story rests on them:
- Skipping. Equal structural hashes ⇒ no ops, no descent. A patch is O(changed), not O(tree) (§5.1).
- Keyed children. Lists reorder by
Move, not by rebuilding — which is also what preserves focus and scroll position in the browser (§5.1 “frame identity”). - Sequential application. Ops are emitted in the order the client must apply them; each index is valid against the DOM as it exists at that moment, which is why removals descend and insertions ascend.
Enums§
Functions§
- apply
- Apply a patch to an
Htmlvalue — the server-side model of what the browser does. - diff
- Diff two views of the same frame.
Type Aliases§
- Path
- A node address: child indices from the root of the subscription’s frame.