Forem

Simon
Simon

Posted on

5

What would I use Rust for?

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

Top comments (4)

Collapse
 
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.

Collapse
 
geoxion profile image
Dion Dokter

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

Collapse
 
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.

Collapse
 
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 rust-lang.org.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay