[−][src]Function secret_keeper::util::form_get
pub fn form_get<'v>(
fields: &'v Vec<(String, String)>,
key: &str
) -> Option<&'v str>
parse the list of key-value tuples to find the value associated with the given key.
This is useful for parsing the results of serde_urlencoded::from_str
.
use secret_keeper::util::form_get; let fields = vec!{ ("one".to_string(),"apple".to_string()), ("two".to_string(),"banana".to_string()) }; assert_eq!(form_get(&fields, "one"), Some("apple")); assert_eq!(form_get(&fields, "two"), Some("banana")); assert_eq!(form_get(&fields, "three"), None);