Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::collections::HashMap;
- fn main() {
- let mut operations: HashMap<String, String> = HashMap::new();
- operations.insert("dup".to_string(),"dup".to_string());
- operations.insert("drop".to_string(),"drop".to_string());
- operations.insert("swap".to_string(),"swap".to_string());
- operations.insert("over".to_string(),"over".to_string());
- match operations.get("dup").cloned() {
- Some(f) => {
- match f {
- "dup".to_string() => println!("{}", f),
- _ => println!("{}", "else")
- }
- }
- None => println!("{}", "test_none")
- }
- }
Add Comment
Please, Sign In to add comment