(target: &mut ParseValue, subkeys: &[String], value: ParseValue)
| 462 | } |
| 463 | |
| 464 | fn insert_into_map(target: &mut ParseValue, subkeys: &[String], value: ParseValue) { |
| 465 | if subkeys.is_empty() { |
| 466 | *target = value; |
| 467 | return; |
| 468 | } |
| 469 | |
| 470 | let ParseValue::Map(map) = target else { |
| 471 | *target = ParseValue::Map(HashMap::new()); |
| 472 | insert_into_map(target, subkeys, value); |
| 473 | return; |
| 474 | }; |
| 475 | |
| 476 | if subkeys.len() == 1 { |
| 477 | map.insert(subkeys[0].clone(), value); |
| 478 | return; |
| 479 | } |
| 480 | |
| 481 | let child = map |
| 482 | .entry(subkeys[0].clone()) |
| 483 | .or_insert_with(|| ParseValue::Map(HashMap::new())); |
| 484 | insert_into_map(child, &subkeys[1..], value); |
| 485 | } |
| 486 | |
| 487 | pub fn cached_parser(format: &str, case_sensitive: bool) -> Option<Arc<Parser>> { |
| 488 | get_cached_parser(format, case_sensitive) |
no test coverage detected