Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. fn match_string(arg: &Option<String>) -> bool {
  2. match arg.into_iter().map(|arg| arg.as_ref()).next() {
  3. Option::Some("hello world") => true,
  4. _ => false
  5. }
  6. }
  7.  
  8. fn main() {
  9. let str = "hello world".to_string();
  10. println!("foo, {}", match_string(&Some(str)));
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement