Skip to content

Instantly share code, notes, and snippets.

@prepor
Created February 9, 2018 15:56
Show Gist options
  • Select an option

  • Save prepor/2ebdf7aebc52c01aaa7d4bbec065c5cc to your computer and use it in GitHub Desktop.

Select an option

Save prepor/2ebdf7aebc52c01aaa7d4bbec065c5cc to your computer and use it in GitHub Desktop.
enum Bar {
One(String),
Two(String)
}
struct Foo {
bars: Vec<Bar>
}
impl Foo {
fn x(&mut self) {
match self.bars[0] {
Bar::One(ref c) => self.y(),
Bar::Two(_) => self.y()
}
}
fn y(&mut self) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment