Rust
Race to Replace C has already ended… and Rust is the clear winner.
What is Rust?
Rust was designed by Software developer Graydon Hoare while working at Mozilla Research in 2006. Know more about the history and evolution of Rust.
Rust is a multi-paradigm, strongly typed, blazingly fast, a memory-efficient language designed for safety and performance. Rust guarantees memory safety and thread safety, empowering developers to debug at compile time.
Installation
Install on Linux & macOS:
Fire up a terminal and paste the below command snippet.
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh
The above command snippet downloads and installs rust in your system.
If you get linker errors, you should install a C compiler, which will typically include a linker. A C compiler is also useful because some common Rust packages depend on C code and will need a C compiler.
On macOS:
xcode-select --install
On Linux:
sudo apt install build-essential
Install on Windows:
Refer to the link to install rust on your windows machine.
Write your first program in Rust.
Open a new terminal and create a directory.
mkdir projects
Change your present working directory to the directory you created.
cd projects
Create a new file called first_program.rs
and add the following lines to that file.
fn main(){
println!("Hello Wolrd")
}
Compile your first program by running the command.
rustc first_program.rs
Which creates an executable binary that can be executed by running:
./main.rs
If you see Hello World
in your terminal, Hurray!! You have successfully written and executed your first program in rust.