Added a rust-idiomatic version of pattern matching as conditional guard.