Skip to main content

diff_states

Function diff_states 

Source
pub fn diff_states(old: &Value, new: &Value) -> Option<Patch>
Expand description

Computes the difference between two JSON states as a JSON Patch.

Returns None if the states are identical.

ยงExample

use ag_ui_core::state::diff_states;
use serde_json::json;

let old = json!({"count": 0});
let new = json!({"count": 5});

let patch = diff_states(&old, &new);
assert!(patch.is_some());