Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum Foo {
- Bar(String),
- Baz(usize)
- }
- impl Foo {
- fn take_as_bar(self) -> Option<String> {
- match self {
- Foo::Bar(s) => Some(s),
- Foo::Baz(_) => None
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement