Guest User

Untitled

a guest
Jul 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. use std::collections::HashMap;
  2. fn main() {
  3. let mut operations: HashMap<String, String> = HashMap::new();
  4. operations.insert("dup".to_string(),"dup".to_string());
  5. operations.insert("drop".to_string(),"drop".to_string());
  6. operations.insert("swap".to_string(),"swap".to_string());
  7. operations.insert("over".to_string(),"over".to_string());
  8.  
  9. match operations.get("dup").cloned() {
  10. Some(f) => {
  11. match f {
  12. "dup".to_string() => println!("{}", f),
  13. _ => println!("{}", "else")
  14. }
  15. }
  16. None => println!("{}", "test_none")
  17. }
  18. }
Add Comment
Please, Sign In to add comment