pub fn can_apply_patch(target: &Value, patch: &Patch) -> boolExpand description
Checks if applying a patch would succeed without actually modifying the target.
This is useful for validation before committing to a patch operation.
ยงExample
use ag_ui_core::patch::{can_apply_patch, PatchBuilder};
use serde_json::json;
let state = json!({"count": 0});
let valid_patch = PatchBuilder::new().replace("/count", json!(1)).build();
let invalid_patch = PatchBuilder::new().remove("/nonexistent").build();
assert!(can_apply_patch(&state, &valid_patch));
assert!(!can_apply_patch(&state, &invalid_patch));