# Rust

> A fast programming language whose compiler refuses to build code with memory bugs.

- Level: Intermediate
- Topics: Software
- URL: https://tidbit.legios.com.ar/rust/
- In Spanish: [Rust](https://tidbit.legios.com.ar/es/rust/)

**Rust** is a programming language that started at Mozilla and reached version 1.0 in 2015. It aims at the same jobs as C and C++: operating systems, browsers, databases, game engines, embedded devices, anything where speed and control over memory matter. What makes it different is that it is designed to prevent a whole family of memory bugs that have plagued those languages for decades.

In C and C++ the programmer manages memory by hand, and small mistakes, like using memory after freeing it or writing past the end of a buffer, cause crashes and many serious security holes. Languages like Java or Python avoid that with a garbage collector, which costs some speed and predictability. Rust takes a third path: strict rules about which part of the code owns each piece of data and who may borrow it. The compiler's **borrow checker** enforces those rules, so most of those bugs simply do not compile, and the final program runs as fast as C.

The price is a steep learning curve: the compiler says no often, especially at first. Even so, Rust has gained ground quickly. It is part of the Linux kernel, Windows and Android; companies like AWS, Cloudflare and Microsoft use it in critical services; and security agencies recommend memory-safe languages like it for new code. It comes with `cargo`, a tool that builds projects and manages libraries.

## An analogy

A very strict building inspector who checks the plans before a single brick is laid. It is slower to get approval, but once the building goes up, a whole category of collapses simply cannot happen.

## Keep in mind

- As fast as C and C++, without a garbage collector.
- The borrow checker rejects most memory bugs at compile time.
- Used in Linux, Windows, Android and cloud infrastructure.
- Harder to learn than most languages, especially at first.

## Go deeper

- [Rust (official site)](https://www.rust-lang.org/)
- [The Rust Programming Language (official book)](https://doc.rust-lang.org/book/)

## Related terms

- [Programming language](https://tidbit.legios.com.ar/programming-language/): A precise, written language people use to give instructions to a computer.
- [Mozilla](https://tidbit.legios.com.ar/mozilla/): The nonprofit-owned organization behind the Firefox browser and an open web.
- [C and C++](https://tidbit.legios.com.ar/c-and-cpp/): Two old, fast languages that sit underneath operating systems, browsers and games.
- [Operating system](https://tidbit.legios.com.ar/operating-system/): The base software that runs a device and lets every app share its hardware.
- [Web browser](https://tidbit.legios.com.ar/web-browser/): The app that fetches web pages from the internet and draws them on your screen.
- [Database](https://tidbit.legios.com.ar/database/): An organized store of data that programs can search and update safely.
- [Bug](https://tidbit.legios.com.ar/bug/): A mistake in software that makes it behave differently from what was intended.
- [Java](https://tidbit.legios.com.ar/java/): A long-lived programming language behind many bank systems, big business apps and Android.
