Skip to main content

Crate netform_diff

Crate netform_diff 

Source
Expand description

Diff engine and reporting primitives for netform_ir::Document.

This crate builds comparison views from lossless IR documents, applies explicit normalization and ordering policies, and emits deterministic edits.

Primary entrypoints:

§Example

use netform_diff::{diff_documents, NormalizeOptions};
use netform_ir::parse_generic;

let left = parse_generic("hostname old\n");
let right = parse_generic("hostname new\n");
let diff = diff_documents(&left, &right, NormalizeOptions::default());
assert!(diff.has_changes);

Structs§

ComparisonLine
One normalized line in the internal comparison view.
ComparisonView
Flattened line-oriented view derived from a document.
Diff
Top-level diff output contract.
DiffLine
Serializable line payload embedded in diff edits.
DiffStats
Aggregate counters for diff output.
EditAnchor
Path/span anchor for edit placement and diagnostics.
Finding
Warning/info emitted during parse propagation or diff uncertainty handling.
NormalizeOptions
Options controlling normalization and ordering semantics for diffing.
OrderPolicyConfig
Ordering policy configuration with a default and longest-prefix overrides.
OrderPolicyOverride
Path-based policy override for specific subtree contexts.
Plan
Transport-neutral action plan derived from a Diff.
PlanFinding
Plan-level warning (for example missing anchors).
PlanLineEdit
One line-oriented edit in apply_line_edits_under_context.

Enums§

Edit
Edit script operation emitted by the diff engine.
FindingLevel
Severity level for a Finding.
KeyKind
Key namespace discriminator used when hashing comparison identities.
NormalizationStep
One ordered normalization step in the comparison pipeline.
OrderPolicy
Ordering behavior used when comparing sibling lines in a context.
PlanAction
Action variants emitted in a Plan.
PlanLineEditKind
Line operation kind for PlanLineEdit.

Functions§

build_comparison_view
Build a flattened comparison view from a parsed document.
build_plan
Convert a Diff into a transport-neutral action plan.
derive_content_key
Derive a content key from parent signature, key kind, trivia, and normalized text.
derive_occurrence_key
Derive an occurrence key from content key and 1-based ordinal.
diff_documents
Compute a deterministic diff between two parsed documents.
format_markdown_report
Format a markdown-oriented human report from a diff result.