Crate fionn_diff

Crate fionn_diff 

Source
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 path
  • remove: Delete a value at a path
  • replace: Replace a value at a path
  • move: Move a value from one path to another
  • copy: Copy a value from one path to another
  • test: Verify a value equals the expected value

§JSON Merge Patch (RFC 7396)

A simpler merge format where:

  • Objects are recursively merged
  • null values 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§

DiffOptions
Options for diff generation.
JsonPatch
A JSON Patch document (sequence of operations).
JsonPatchRef
A JSON Patch document with zero-copy operations.

Enums§

PatchError
Error type for patch operations.
PatchOperation
A single patch operation.
PatchOperationRef
A single patch operation with zero-copy paths where possible.

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.
deep_merge
Deep merge two objects, preferring values from overlay.
json_diff
Generate a JSON Patch that transforms source into target.
json_diff_with_options
Generate a JSON Patch with custom options.
json_diff_zerocopy
Generate a zero-copy JSON Patch that transforms source into target.
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_patch_to_value
Generate a merge patch from two JSON documents.
simd_bytes_equal
SIMD-accelerated byte slice equality check.
simd_find_first_difference
Find the first position where two byte slices differ.