Skip to content

Instantly share code, notes, and snippets.

@danielbodart
Last active December 22, 2016 11:50
Show Gist options
  • Select an option

  • Save danielbodart/567d000ffb7c0ee89f140487c869d768 to your computer and use it in GitHub Desktop.

Select an option

Save danielbodart/567d000ffb7c0ee89f140487c869d768 to your computer and use it in GitHub Desktop.
fn get<'a>(headers: &'a Vec<(&str, String)>, name:&str) -> Option<&'a str> {
headers.into_iter().find(|&&(key,_)| name.eq_ignore_ascii_case(key)).map(|&(_,&value)|value)
} // ^^^^^^ expected struct `std::string::String`, found reference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment