Expand description
Format-agnostic patch application traits Format-agnostic patch application
This module provides the Patchable trait for applying patches to values.
It extends DiffableValue with mutation capabilities needed for patch
application.
§Key Types
Patchable- Trait for values that can have patches appliedPatchError- Errors that can occur during patch application
§Example
ⓘ
use fionn_core::patchable::{Patchable, apply_patch};
use fionn_core::diffable::{GenericPatch, GenericPatchOperation};
let mut target = serde_json::json!({"name": "Alice"});
let patch = GenericPatch::with_operations(vec![
GenericPatchOperation::Replace {
path: "/name".to_string(),
value: serde_json::json!("Bob"),
},
]);
apply_patch(&mut target, &patch)?;
assert_eq!(target["name"], "Bob");Enums§
- Patch
Error - Errors that can occur during patch application
Traits§
- Patchable
- Trait for values that can have patches applied
Functions§
- apply_
operation - Apply a single operation to a value
- apply_
patch - Apply a patch to a value
- parse_
pointer - Parse a JSON Pointer path into segments