Layers `right` (higher precedence) onto `left` in place. Objects merge recursively and arrays/scalars are replaced by `right`, except the top-level `components` array, whose entries pair by `kind` in order of appearance so multi-instance kinds are not collapsed. Internal helper shared by plugin initialization and `plugins.toml` discovery.
(left: &mut Json, right: Json)
| 907 | /// multi-instance kinds are not collapsed. Internal helper shared by plugin |
| 908 | /// initialization and `plugins.toml` discovery. |
| 909 | fn layer_config(left: &mut Json, right: Json) { |
| 910 | match (left, right) { |
| 911 | (Json::Object(left), Json::Object(right)) => { |
| 912 | for (key, value) in right { |
| 913 | match (key.as_str(), left.get_mut(&key)) { |
| 914 | ("components", Some(existing)) => merge_plugin_components(existing, value), |
| 915 | (_, Some(existing)) => merge_json_value(existing, value), |
| 916 | (_, _) => { |
| 917 | left.insert(key, value); |
| 918 | } |
| 919 | } |
| 920 | } |
| 921 | } |
| 922 | (left, right) => *left = right, |
| 923 | } |
| 924 | } |
| 925 | |
| 926 | /// Merges `right` components into `left` by `kind`, pairing repeated kinds positionally. |
| 927 | fn merge_plugin_components(left: &mut Json, right: Json) { |