Skip to content

Instantly share code, notes, and snippets.

@hugoledoux
Created February 14, 2019 09:38
Show Gist options
  • Save hugoledoux/44fed47b35c1689d4a4b9388f338c194 to your computer and use it in GitHub Desktop.
Save hugoledoux/44fed47b35c1689d4a4b9388f338c194 to your computer and use it in GitHub Desktop.
fn main() {
let test = vec!["one", "two", "three"];
let index = test.iter().position(|&r| r.to_string() == "two").unwrap();
println!("{}", index);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment