pub fn int_val_parser<T>(
data: &mut HashMap<String, Option<String>>,
key: &'static str,
) -> Result<T, Ts3Error>where
T: FromStr<Err = ParseIntError>,
Expand description
Helper function to retrieve and parse value from line-hashmap, (re)moves value.
use ts3_query::*;
use std::collections::HashMap;
let mut v: HashMap<String, Option<String>> =
vec![("abc".to_string(), Some("123".to_string())),
("def".to_string(), None)]
.into_iter().collect();
assert_eq!(123,raw::int_val_parser::<i32>(&mut v, "abc").unwrap());
assert!(raw::int_val_parser::<i32>(&mut v, "def").is_err());