DEV Community


Posted on

What would I use Rust for?

What is Rust good for? (Assume essentially no knowledge of “low level” languages like C)

Top comments (4)

deciduously profile image
Ben Lovy • Edited

Rust is great for all kinds of things.

It produces native binaries, so Rust applications are easy to deploy, and has a robust package manager and growing package ecosystem. This makes it good for writing CLI tools to be distributed around that need to be portable and cross-platform without reinventing the wheel.

It also has strong support for compiling to WebAssembly, so it's useful for replacing computationally heavy code paths in web applications, or building whole apps from the ground up intended for WASM distribution.

Rust has strong support for FFI with C, so it's a good choice for either interfacing with C libraries or writing new libraries that will need to be consumed by C or C++ applications, as well as a good choice for re-implementing C libraries in a more modern, memory-safe language without compromising on performance.

Rust's unique semantics and std::sync standard library module greatly simplify the task of writing correct concurrent code, making Rust a good choice for networking applications or other concurrent domains where tools like Akka/Scala or Erlang are used.

It can also be a good choice for porting data-crunching logic that an existing Python app may not be able to keep up with. It offers programmers a robust set of tools like iterators and generics for expressively manipulating data and expressing algorithms, but will in general run much more efficiently than equivalent Python.

I'm pretty biased, but I think Rust is a pretty good fit for most of the code I write, the notable exception being quick one-off scripts. I'd use something more dynamic and forgiving for that, but for nearly everything else Rust's modelling power is a plus unless you depend on some ecosystem tool in your current language that Rust hasn't caught up with yet.

geoxion profile image
Dion Dokter

Well, I have nothing more to add. Good answer!

deciduously profile image
Ben Lovy

Yes! Not even essentially, it's straight up a whole free book that gets you productive at a beginner-to-intermediate level.

jpcc99 profile image
João Pedro Carvalho

Rust is system programming language, like C, has no garbage collection, can be compiled to web assembly for the web and its works with concepts like immutability and ownership to work with threads. It's also well documented. So, take a look on