Skip to main content

Module view_diff

Module view_diff 

Source
Expand description

Additive Tier-1 hot-patch differ for view! { ... } Rust source files powered by nativeview_view_syntax.

Compares old vs new .rs source files containing view! blocks:

  • Single-sources lexing, view! scanning/parsing, deterministic XXH64 [AnchorKey] computation, string interpolation analysis, and the Tier-1 direct-root allowlist (Node, LeafNode, Text, Pressable, ScrollView, Column, Row, bare string literals) directly from nativeview-view-syntax.
  • Reuses hot_diff’s typed attribute specs, const evaluator, TypedStyle/Style chain scanner, and direct binary RowPatch word lowering (zero CSS string emission).
  • Emits HotPatchMsg::TemplatePatch with template_key = anchor_key.0 and node_path = Vec::new(), matching nativeview_hot_reload::HotPatchIndex’s O(1) contract.
  • Falls back cleanly to ViewDiffOutcome::NeedsRebuild for non-view! Rust code edits, structural tree edits, control-flow changes, dynamic expressions, interpolated strings, or composite component (Button, Card, Dialog, path-qualified tags) edits.

Re-exports§

pub use patch::TypedViewPatch;
pub use patch::ViewAnchorTarget;
pub use patch::ViewAttrChange;
pub use patch::ViewTextChange;

Modules§

patch
Typed Tier-1 patch model (TypedViewPatch) and AnchorKey-addressed binary HotPatchMsg::TemplatePatch lowering for view! files.

Enums§

ViewDiffOutcome
Classification of a watched .rs file save containing view! { ... } blocks.

Functions§

classify_for_watch
Watch-loop classifier behind crate::hot_diff::WatchCache::classify_batch.
diff_view_source
Diffs old_src against new_src for a .rs file at rel_file containing view! { ... } blocks and classifies the edit as ViewDiffOutcome::NoOp, ViewDiffOutcome::Tier1Patch, or ViewDiffOutcome::NeedsRebuild.
has_view_macro
Fast, zero-allocation pre-check followed by token confirmation returning true iff src contains at least one view! { ... } / view!(...) / view![...] macro invocation outside comments, string literals, macro_rules! definitions, and .view! method positions.