Skip to main content

apply_merge_patch

Function apply_merge_patch 

Source
pub fn apply_merge_patch<T>(current: T, patch_json: &str) -> Result<T, Error>
Expand description

Applies a JSON Merge Patch (RFC 7396) to the given value.

Consumes current, merges the patch, and returns a new updated value. Fields present in the patch replace the corresponding fields in current. null in the patch removes the field (if the target type supports it, e.g. Option<T>). Absent fields remain unchanged.

ยงErrors

Returns an error if serialization, deserialization, or patch parsing fails.