(
object: &'a BTreeMap<String, JsonValue>,
key: &str,
context: &str,
)
| 668 | } |
| 669 | |
| 670 | fn optional_string<'a>( |
| 671 | object: &'a BTreeMap<String, JsonValue>, |
| 672 | key: &str, |
| 673 | context: &str, |
| 674 | ) -> Result<Option<&'a str>, ConfigError> { |
| 675 | match object.get(key) { |
| 676 | Some(value) => value |
| 677 | .as_str() |
| 678 | .map(Some) |
| 679 | .ok_or_else(|| ConfigError::Parse(format!("{context}: field {key} must be a string"))), |
| 680 | None => Ok(None), |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | fn optional_bool( |
| 685 | object: &BTreeMap<String, JsonValue>, |
no test coverage detected