Rust is a fairly new language invented by Mozilla, originally to help them rewrite parts of Firefox to make it faster. What they really wanted to achieve with Rust was concurrency safety, so they could re-implement their browser engine (servo) to take maximum advantage of parallelism while minimising bugs and security issues.
In the saturated world of programming languages, Rust has managed to introduce some quite innovative features not really seen before in the mainstream programming world, and some of these features are now starting to gain more traction in other mature languages and compilers. For example, the C++ Lifetime Profile is a de facto standard that is currently being implemented in Clang and Visual Studio. Compile-time checking of memory and concurrency safety are a logical next step for all non-managed languages, so learning about these principles in Rust now will prepare you for
them in languages you might use professionally today.
Rust is also worth learning because it’s quite a nice modern language. It has functional programming, immutability or mutability, a powerful package manager (cargo) and a great active community. It’s mature enough to write production code in, but still new enough that the language is still evolving.
So let’s have a quick look at what some simple Rust code looks like, shall we? This example is from a small side project that parses CSV data about stars in our galaxy and writes them back out to disk in a binary format that a web front end can then stream into a WebGL graphics renderer as vertex and colour data. The code below shows how you can read a CSV file, iterate over the lines, call utility functions to parse the textual data into other formats, then serialise it out into a binary output file.
Of course this is a very fast and short dive into Rust. We haven’t even touched on borrow checking or other interesting features yet, but hopefully this has given you a feel for the language and what it’s generally about: safety, performance, and clean, readable code.
Like what you see? Here’s some further reading:
https://www.udemy.com/course/rust-lang (Paid course)