Skip to main content

deep_merge_tapes

Function deep_merge_tapes 

Source
pub fn deep_merge_tapes<S: TapeSource, T: TapeSource>(
    base: &S,
    overlay: &T,
) -> Result<Value>
Expand description

Deep merge two tapes (preserves null values)

Unlike merge_tapes (RFC 7396), this preserves null values instead of treating them as deletions.

§Example

let base = parse_json(r#"{"a": 1, "b": 2}"#);
let overlay = parse_json(r#"{"b": null, "c": 3}"#);

let result = deep_merge_tapes(&base, &overlay)?;
// {"a": 1, "b": null, "c": 3}

§Errors

Returns an error if either tape cannot be converted to a value.