Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::collections::HashMap;
- #[derive(Debug)]
- pub enum Toto {
- Bli,
- Bla,
- Top
- }
- type Env = HashMap<String, Toto>;
- fn get(key: &String, e: &Env) -> Toto {
- match e.get(key) {
- Some(t) => {
- let x = t.clone();
- x // x has type &Toto instead of the expected(?) Toto
- // if Toto derives Clone, then x has type Toto, as expected
- },
- None => Toto::Top
- }
- }
- fn main() {
- println!("Hello, world!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement