Merge an incoming map into an existing map. - If `incoming` is empty, return `existing` unchanged (no-op). - Otherwise, upsert all incoming entries into `existing`. - Entries with an empty-string value are removed (delete semantics).
(
mut existing: std::collections::HashMap<String, String>,
incoming: std::collections::HashMap<String, String>,
)
| 388 | /// - Otherwise, upsert all incoming entries into `existing`. |
| 389 | /// - Entries with an empty-string value are removed (delete semantics). |
| 390 | fn merge_map( |
| 391 | mut existing: std::collections::HashMap<String, String>, |
| 392 | incoming: std::collections::HashMap<String, String>, |
| 393 | ) -> std::collections::HashMap<String, String> { |
| 394 | if incoming.is_empty() { |
| 395 | return existing; |
| 396 | } |
| 397 | for (key, value) in incoming { |
| 398 | if value.is_empty() { |
| 399 | existing.remove(&key); |
| 400 | } else { |
| 401 | existing.insert(key, value); |
| 402 | } |
| 403 | } |
| 404 | existing |
| 405 | } |
| 406 | |
| 407 | fn merge_i64_map( |
| 408 | mut existing: std::collections::HashMap<String, i64>, |
no test coverage detected