Skip to main content

merge_metadata

Function merge_metadata 

Source
pub fn merge_metadata(
    existing: Option<&JsonObject>,
    incoming: Option<&JsonObject>,
) -> Option<JsonObject>
Expand description

Folds incoming into existing, key by key, with the last write winning.

Returns a new object rather than mutating either argument. An absent incoming returns existing unchanged (cloned); an empty incoming changes nothing. A key’s value is replaced outright — this never recurses, so an object or array under any key, AGUI_METADATA_KEY included, is replaced wholesale rather than blended with what was there before. To add to a nested structure, send the complete new value.