Rust Parser and State Machine

Image for post
Image for post

Rust it’s a very nice and powerful language. I believe Rust has a place beyond systems and hardware programming. I personally believe we will be seeing more and more Rust in the following years just like Go took some time to liftoff I believe Rust time is yet to come. Rust it’s powerful because favors safe programming not only in sense of memory management but also combined with functional programming we can get the best of all words meaning: Safety, Productivity, Less code, Doing more with less, reducing complexity, and leverage engineering best practices. Today I want to show how easily we can write a cyclic state machine parser with Rust and without using any crates but really 100% on the standard language. So Let’s get started.

The Video

The Code

Cheers,

Diego Pacheco

Originally published at http://diego-pacheco.blogspot.com on January 10, 2021.

Brazilian, Software Architect, SWE(Java, Scala, Rust, Go) SOA & DevOps expert, Author. Working with EKS/K8S. diegopacheco.github.io (Opinions on my own)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store