3 ms·
Did you look at the if let syntax? if let Bar::Qux(x) = foo { ... )
by bombela 7y ago
Did you look at the if let syntax?
if let Bar::Qux(x) = foo { ... )
- _-___________-_ 7y agoIt looks like they want to panic if the variant is not what they expect. Basically implement their own unwrap() for their own enum, since the above logic is basically what Option::unwrap() does for Option::Some. Assuming there's not some wider design issue, I'd probably implement an unwrap_qux() method on the Bar enum