1.1 Introduction to Rust

Rust is a system-level programming language.

Rust was developed by Graydon Hoare and flourished after being acquired by Mozilla LABS.

1.2 Application and language

It is well known that the Java and C# languages are commonly used to build user-oriented software. Business applications such as spreadsheets, word processors, Web applications or mobile applications.

As for machine-oriented system-level applications, due to the high requirements for performance and concurrency, the languages used by systems, software and software platforms are almost all C and C++ languages, such as their operating systems, game engines, compilers, etc. These programming languages require a high degree of hardware interaction.

System-level and application-level programming languages face two major problems:

  • It is difficult to write a highly secure language, especially with dangling Pointers, buffer overflows and memory leaks caused by C/C++ Pointers

  • Lack of high concurrency features at the language level.

1.3 Why Rust?

Why Rust?

There are plenty of reasons, but for me, the biggest reason is that byteDance’s fly chat team already uses Rust. This means that learning Rust can lead to well-paying jobs.

Furthermore, as the Rust language itself puts it, the Rust language has three visions:

  • High safety

  • A high performance

  • High concurrency

The Rust language is designed to develop highly reliable and fast software in a simple manner.

The Rust language supports the use of modern language features to write system-level and even machine-level programs.

1.3.1 high performance

High performance is the highest aspiration of all languages, and Rust is no exception.

In pursuit of extreme performance, Rust has abandoned the Garbage Collector (GC) found in languages other than C/C++.

This eliminates the performance cost of garbage collection.

1.3.2 Memory security at compile time

Rust does have Pointers, but the concept has been greatly weakened so that it does not suffer from the dangling Pointers, buffer overflows, and memory leaks of C/C++.

1.3.3 Naturally multithreaded programs run safely

Rust is a system-level language designed for multi-threading with high concurrency

Rust’s concept of ownership and memory security rules make it inherently supportive of high concurrency, and high concurrency without data contention.

1.3.4 Rust Supports the Web Assembly (WASM) language

Rust aims to be a highly concurrent and secure system-level language, but that doesn’t mean it can’t develop Web applications.

Rust supports fast, reliable execution on the browser side by compiling code into the Web Assembly (WASM) language.

The Web Assembly (WASM) language is designed to run on browser-side/embedded devices to execute CPU-intensive languages.

That said, the Goal of the Web Assembly (WASM) language is to run in a browser like Javascript, but more efficiently because it’s compiled.