fionn_diff/lib.rs
1// SPDX-License-Identifier: MIT OR Apache-2.0
2//! # JSON Diff/Patch/Merge
3//!
4//! High-performance JSON structural operations with SIMD acceleration.
5//!
6//! This module provides three related capabilities:
7//!
8//! ## JSON Diff
9//! Generate a list of operations that transform one JSON document into another.
10//! Follows the spirit of RFC 6902 (JSON Patch) for the output format.
11//!
12//! ## JSON Patch (RFC 6902)
13//! Apply a sequence of operations to a JSON document:
14//! - `add`: Insert a value at a path
15//! - `remove`: Delete a value at a path
16//! - `replace`: Replace a value at a path
17//! - `move`: Move a value from one path to another
18//! - `copy`: Copy a value from one path to another
19//! - `test`: Verify a value equals the expected value
20//!
21//! ## JSON Merge Patch (RFC 7396)
22//! A simpler merge format where:
23//! - Objects are recursively merged
24//! - `null` values indicate deletion
25//! - Other values replace existing ones
26//!
27//! ## Performance
28//!
29//! Uses SIMD acceleration for:
30//! - Bulk string comparison (detect unchanged strings quickly)
31//! - Array element comparison
32//! - Finding longest common subsequence in arrays
33
34mod compute;
35mod diff_zerocopy;
36mod merge;
37mod patch;
38mod simd_compare;
39
40pub use compute::{DiffOptions, json_diff, json_diff_with_options};
41pub use diff_zerocopy::{JsonPatchRef, PatchOperationRef, json_diff_zerocopy};
42pub use merge::{deep_merge, json_merge_patch, merge_many, merge_patch_to_value};
43pub use patch::{JsonPatch, PatchError, PatchOperation, apply_patch, apply_patch_mut};
44pub use simd_compare::{
45 json_numbers_equal, json_strings_equal, simd_bytes_equal, simd_find_first_difference,
46};