Function
as_integer
(map: &Table, key: &str, default: T)
Source from the content-addressed store, hash-verified
| 2 | use toml::value::*; |
| 3 | |
| 4 | pub fn as_integer<T>(map: &Table, key: &str, default: T) -> T |
| 5 | where |
| 6 | T: 'static + Copy, |
| 7 | i64: AsPrimitive<T>, |
| 8 | { |
| 9 | map.get(key) |
| 10 | .map(|x| { |
| 11 | x.as_integer() |
| 12 | .unwrap_or_else(|| panic!("Invalid arguments in field {}", key)) |
| 13 | .as_() |
| 14 | }) |
| 15 | .unwrap_or(default) |
| 16 | } |
| 17 | |
| 18 | pub fn as_bool(map: &Table, key: &str, default: bool) -> bool { |
| 19 | map.get(key) |
Callers
nothing calls this directly
Tested by
no test coverage detected