Created
February 9, 2018 15:59
-
-
Save prepor/a09412cc824675648569c729ba9a378d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Bar { | |
One(String), | |
Two(String) | |
} | |
struct Foo { | |
bars: Vec<Bar> | |
} | |
impl Foo { | |
fn x(&mut self) { | |
let case = match self.bars[0] { | |
Bar::One(ref c) => 1, | |
Bar::Two(_) => 2 | |
}; | |
match case { | |
1 => self.y(), | |
2 => self.y(), | |
_ => panic!("oh!") | |
} | |
} | |
fn y(&mut self) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment