Skip to content

Instantly share code, notes, and snippets.

@zmarvel
Created August 19, 2020 04:06
Show Gist options
  • Save zmarvel/e46471a5cacde2c36c628571cd5b35cf to your computer and use it in GitHub Desktop.
Save zmarvel/e46471a5cacde2c36c628571cd5b35cf to your computer and use it in GitHub Desktop.
struct A {
name: String
}
struct B {
name: String
}
struct C {
}
enum ABC {
A(A),
B(B),
C(C),
}
fn get_name(abc: ABC) -> String {
match abc {
C => String::from(""),
_ => abc.name
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment