Rust?

rust-bg

Rust is a modern systems programming language developed by Mozilla Research, focusing on three goals: performance, safety, and concurrency. The most important motto is “Let’s have the speed and control of low-level languages like C++, while solving the chronic problems caused by memory bugs”. To use an analogy, Rust is an “F1 machine with built-in seatbelts”.

For this reason, I’m currently studying Rust, and this blog was also built with Leptos, a full-stack framework in Rust. (Check out my GitHub.)

So let’s see why Rust is good, how it becomes a strength, and whether Rust is the best.




Rust’s Power

rust power

1. Safety

This is the most important part that distinguishes Rust from other languages. Rust guarantees memory safety through a unique system called ownership. This fundamentally blocks memory-related bugs at compile time, such as null pointers, dangling pointers, and data races that have plagued developers in C or C++.

2. Performance

Rust doesn’t fall behind as a systems programming language. In particular, it’s very fast because it compiles directly to machine code like C/C++. Also, since there’s no garbage collector, there are no unpredictable pauses during program execution, and as a low-level language, it can directly control memory and maximize hardware utilization. How fast is it? It’s the second fastest after C/C++, and the difference is minimal.

3. Concurrency

Rust is designed to utilize multicore processors safely and easily. The ownership and borrow checker rules apply equally when sharing data across multiple threads, so the compiler prevents dangerous situations (data races) where multiple threads try to modify data simultaneously, allowing developers to write parallel processing code with confidence.

As a result, Rust is mainly used in these fields:

  • Web Backend: Fast and stable web servers, API development
  • Command-line tools (CLI): Many famous CLI tools like ripgrep and bat are made with Rust
  • WebAssembly: Widely used to run code in web browsers at near-native speed
  • Embedded Systems: Microcontroller or IoT device programming
  • Blockchain: Used as the core language for many blockchain projects like Solana and Polkadot
  • Game Development: Game engines and high-performance game logic

So, does Rust with such good features eventually replace C++ and become the authoritative language?




But Realistically…

rust is good!

As mentioned earlier, Rust is a language that captures both performance and stability. However, why do many people want to learn Rust but don’t?

1. Steep Learning Curve

Rust is notorious for being difficult to learn. In particular, concepts like “ownership” and “borrow checker” mentioned above are unfamiliar and a major barrier even to developers familiar with other languages. Also, many complex concepts (lifetimes, pointers, traits, etc.) exist, making it imprinted in numerous developers as a difficult language to master.

2. Slow Compilation Time

The Rust compiler performs a tremendous amount of work to ensure safety. Because of this, compilation speed is slower compared to other languages. As the project grows, the waiting time to make a small code change and see the results increases. This can cause frustration during the prototyping stage where fast iteration is important. Of course, tools like incremental compilation and cargo check alleviate this, but it’s still slow compared to interpreted languages like Python or languages with fast compilation like Go.

3. Small Ecosystem

As mentioned before, compared to mainstream languages like Java, Python, and JavaScript, the ecosystem is still small. In particular, there are many cases where libraries are lacking, and you often have to create them yourself, which increases development time.

4. Code Verbosity

Because it emphasizes safety and clarity, code can be longer than other languages. For example, explicit error handling using Result and match is very stable, but looks verbose compared to try-catch syntax. (There is the ? operator, but it still looks verbose.) Also, sometimes you need to explicitly specify lifetimes, which makes the code more complex.

Conclusion

As a result, Rust is a language with a clear “trade-off” that requires more time and effort than other languages in the initial development stage, and in return gains runtime stability and high performance. Also, you need to check not only the language but also other external factors to see its true value.

Therefore, just because Rust is good doesn’t mean it can replace C++. The ecosystem and library scale are smaller than C++, and there are many companies already operating with C++, and these companies don’t need to abandon their existing framework and switch to the difficult Rust. So learning Rust can’t be a strength in employment or job change. If you’re thinking “I want to learn Rust and go to a high-paying company”, please reconsider.




Then Why Did You Choose Rust?

loved tech

Is there really a reason for this question?

Most people who choose their first programming language choose JavaScript or Python. You would know how trivial it is to ask someone who chose Python “Why did you choose Python instead of JavaScript?”

You don’t really need a reason to choose. Of course, there will be many reasons, but I think “a language you find attractive and want to learn” is sufficient. Someone chooses because they want to do Rust, someone chooses because they want to do C++. And the trials and despairs from that choice belong to the person who made the choice, so others don’t need to argue about it.