Frequently Asked Questions

From Rust Community Wiki
Revision as of 22:06, 4 January 2022 by Notriddle (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

General[edit]

What is Rust?[edit]

Rust is a systems programming language, designed to be safe and fast.

Being safe mostly means that the language has a easy-to-write subset with no undefined behavior; if you never use the unsafe keyword, it's fine. Being fast means that it doesn't require the runtime features that a lot of languages use to achieve that safety, and instead it uses a static analysis system called the borrow checker. And being a systems programming language means it doesn't need a runtime, but can actually be used to implement the operating system facilities that other languages rely on.

Why would I use Rust?[edit]

Rust is being used for almost anything you might write computer software for, but here's a few things it's uniquely fit for:

  • "Speeding up" a program written in another language, like Python, Ruby, and JavaScript.
  • Writing device drivers.
  • Implementing latency-sensitive services like network load balancers and caches.

Why would I not use Rust?[edit]

Rust is specifically aimed at speed and safety. The main feature it gives up is convenience, because the borrow checker will occasionally reject programs that are just fine, but that it can't prove are correct.

Some prominent video game developers have been highly critical of Rust, arguing that memory corruption bugs aren't as big of a deal as being able to iterate quickly on a design, and even if one is shipped, it might just become a fun speedrunning strategy anyway. Others building business logic systems similarly find that Rust is overkill for their needs, preferring to live with the garbage collection pauses because the computer isn't the slowest part of their workflow anyway.

Tooling[edit]

Code Structure[edit]

References and Types[edit]

Traits[edit]

Arrays and Vectors[edit]

Iterators[edit]

Useful Snippets[edit]