Expand description
§JSON Diff/Patch/Merge
High-performance JSON structural operations with SIMD acceleration.
This module provides three related capabilities:
§JSON Diff
Generate a list of operations that transform one JSON document into another. Follows the spirit of RFC 6902 (JSON Patch) for the output format.
§JSON Patch (RFC 6902)
Apply a sequence of operations to a JSON document:
add: Insert a value at a pathremove: Delete a value at a pathreplace: Replace a value at a pathmove: Move a value from one path to anothercopy: Copy a value from one path to anothertest: Verify a value equals the expected value
§JSON Merge Patch (RFC 7396)
A simpler merge format where:
- Objects are recursively merged
nullvalues indicate deletion- Other values replace existing ones
§Performance
Uses SIMD acceleration for:
- Bulk string comparison (detect unchanged strings quickly)
- Array element comparison
- Finding longest common subsequence in arrays
Structs§
- Cell
Change - Change to a single cell
- CsvDiff
- Result of CSV diff
- CsvDiff
Options - CSV diff options
- CsvDiff
Stats - Statistics about a CSV diff
- Diff
Options - Options for diff generation.
- Generic
Diff Options - Options for diff computation
- Generic
Patch - A collection of patch operations (format-agnostic)
- Json
Patch - A JSON Patch document (sequence of operations).
- Json
Patch Ref - A JSON Patch document with zero-copy operations.
- Streaming
Merge Options - Options for streaming merge operations
- Tape
Diff - Result of diffing two tapes
- Tape
Diff Options - Options for tape diff
Enums§
- CsvDiff
Op - A single CSV diff operation
- Diff
Value Kind - Classification of value types for diff operations
- Generic
Patch Error - Errors that can occur during patch application
- Generic
Patch Operation - A single patch operation (format-agnostic)
- Patch
Error - Error type for patch operations.
- Patch
Operation - A single patch operation.
- Patch
Operation Ref - A single patch operation with zero-copy paths where possible.
- RowIdentity
Mode - How rows are identified for diff comparison
- Tape
Diff Op - A tape diff operation
- Tape
Value Owned - Owned tape value for patch operations
Traits§
- Diffable
Value - Trait for values that can be compared for diffing
- Patchable
- Trait for values that can have patches applied
Functions§
- apply_
patch - Apply a JSON Patch to a value, returning a new value.
- apply_
patch_ mut - Apply a JSON Patch to a value in place.
- apply_
tape_ diff - Apply a
TapeDiffto a mutable value - csv_
diff - Compute diff between two CSV representations
- csv_
diff_ tapes - Compute diff between two
TapeSourceCSVs - deep_
merge - Deep merge two objects, preferring values from
overlay. - deep_
merge_ tape_ into_ value - Deep merge a tape onto an existing Value
- deep_
merge_ tapes - Deep merge two tapes (preserves null values)
- diff_
tapes - Diff two tapes and produce a patch
- diff_
tapes_ with_ options - Diff two tapes with custom options
- generic_
apply_ operation - Apply a single operation to a value
- generic_
apply_ patch - Apply a patch to a value
- generic_
compute_ diff - Compute a diff between two values
- generic_
compute_ diff_ with_ options - Compute a diff with custom options
- json_
diff - Generate a JSON Patch that transforms
sourceintotarget. - json_
diff_ with_ options - Generate a JSON Patch with custom options.
- json_
diff_ zerocopy - Generate a zero-copy JSON Patch that transforms
sourceintotarget. - json_
merge_ patch - Apply a JSON Merge Patch (RFC 7396) to a document.
- json_
numbers_ equal - Compare two JSON number representations for equality.
- json_
strings_ equal - Compare two JSON string values for equality.
- merge_
many - Merge multiple JSON documents using merge patch semantics.
- merge_
many_ tapes - Merge multiple tapes left-to-right using RFC 7396 semantics
- merge_
patch_ to_ value - Generate a merge patch from two JSON documents.
- merge_
tape_ into_ value - Merge a tape onto an existing Value
- merge_
tapes - Merge two tapes using RFC 7396 (JSON Merge Patch) semantics
- patch_
tape - Full pipeline: apply diff from
tape_bto value derived fromtape_a - simd_
bytes_ equal - SIMD-accelerated byte slice equality check.
- simd_
find_ first_ difference - Find the first position where two byte slices differ.
- streaming_
merge - Streaming merge that can be interrupted/resumed
- tape_
to_ value - Convert a tape to a
serde_json::Value - three_
way_ patch - Three-way patch: apply diff to a tape and return as Value
- value_
to_ json - Serialize a value back to JSON string
- value_
to_ json_ pretty - Serialize a value back to pretty JSON string