It’s common in the software language community to worry about the “idiomatic” way of doing this. So what’s the idiomatic or rust way to do things. It’s easy to learn new languages and continue with old mindsets coming from C or Java for instance. IMHO Readability, High Cohesion, Loosely coupling, Debugability, Good Design are super important aspects in regards to you are idiomatic or not. But being idiomatic is like following a standard and makes things easier for all engineers. For this blog post, I want to share a video I recorded on using 2 resources in Rust called Pattern Matcher and Result. These mechanisms are not unique to Rust, actually, they are functional programming concepts. The result is also known as a Monad and you can find it in Haskel, Java, Scala, and several other languages, with different names like Either, Maybe, Option, Optional and so on and on. Pattern matcher is also found in lots of languages like Haskell and Scala.
Originally published at http://diego-pacheco.blogspot.com on March 20, 2020.