Rust
Rust is a systems programming language that emphasizes performance, reliability, and productivity. It provides memory safety without garbage collection and supports concurrent programming without data races. Rust is particularly well-suited for developing system tools, embedded systems, and performance-critical applications.
Install rust using rustup
Rustup is the official installer and version management tool for Rust. To install rustup
run the below command.
# Download and run the rustup installer script
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Load Rust environment variables into current shell session
. "$HOME/.cargo/env"
After installation, verify that Rust is properly installed
$ rustc --version
$ cargo --version
Running an example
Let's create a simple Hello World program to test the installation:
Create a new directory, and a new source file for your rust program.
$ mkdir hello_rust && cd hello_rust
$ nano main.rs
Paste the following program in the editor
fn main() {
println!("Hello, Rust!");
}
Now lets compile and run the program.
$ rustc main.rs
$ ./main
Hello, Rust!
You are now ready to run our favorite crustacean compiler 🦀!