(map: &Table, key: &str, default: bool)
| 16 | } |
| 17 | |
| 18 | pub fn as_bool(map: &Table, key: &str, default: bool) -> bool { |
| 19 | map.get(key) |
| 20 | .map(|x| { |
| 21 | x.as_bool() |
| 22 | .unwrap_or_else(|| panic!("Invalid arguments in field {}", key)) |
| 23 | }) |
| 24 | .unwrap_or(default) |
| 25 | } |
| 26 | |
| 27 | pub fn as_str<'a>(map: &'a Table, key: &str, default: &'a str) -> &'a str { |
| 28 | map.get(key) |