(payload: &Value, key: &str)
| 231 | } |
| 232 | |
| 233 | fn non_empty_string_field(payload: &Value, key: &str) -> Option<String> { |
| 234 | payload |
| 235 | .get(key) |
| 236 | .and_then(Value::as_str) |
| 237 | .filter(|value| !value.is_empty()) |
| 238 | .map(ToOwned::to_owned) |
| 239 | } |
| 240 | |
| 241 | #[cfg(test)] |
| 242 | mod tests { |
no test coverage detected