Skip to main content

apply_patch_object

Function apply_patch_object 

Source
pub fn apply_patch_object(
    target: &mut Map<String, Value>,
    patch: &Map<String, Value>,
) -> Result<(), PatchPathError>
Expand description

Apply a whole RFC 8620 §5.3 PatchObject to target.

Each entry is applied with apply_jmap_patch. The value at each pointer is set as given: a top-level key such as "name" replaces that property wholesale, with no nested merge of object values (RFC 8620 §5.3: “The value to set for this property”).

§Errors

Returns any error check_patch_paths returns for patch, and otherwise any error apply_jmap_patch returns for an entry.

§Mutation contract

All-or-nothing: on Err, target is unchanged.