Function empris::prop_cast [−][src]
pub fn prop_cast<'a, T>(map: &'a PropMap, key: &str) -> Option<&'a T> where
T: 'static,
Expand description
Gets a value from a HashMap, and casts it to the type provided.
Example
let metadata = player.get_metadata().await?; let title = match prop_cast::<String>(&metadata, "xesam:title") { Some(t) => t.to_string(), None => "Unknown title".to_string() };