Skip to main content

patch_to_value

Function patch_to_value 

Source
pub fn patch_to_value(patch: &Patch) -> Value
Expand description

Converts a Patch to a JSON value for serialization.

This is useful when you need to send patches over the network or store them as JSON.

ยงExample

use ag_ui_core::patch::{create_patch, patch_to_value};
use serde_json::json;

let patch = create_patch(
    &json!({"x": 1}),
    &json!({"x": 2}),
);

let json = patch_to_value(&patch);
assert!(json.is_array());