Rust — Intro and Installation in Ubuntu

Rust is a new age programming language that tries to fight our bad practices in coding. It is a Systems Programming Language, which runs almost as fast as c, and c++.

Rust started off as a side project by Graydon Hoare in 2006, when he was working with Mozilla on Servo (a browser engine). Rust released its version 1.0 on 15 May, 2015, and ever since then it releases a new stable version every six weeks once.

I have faced several hurdles while learning and understanding Rust Language, Hence, I have planned to write a series of stories in medium, documenting the same. If anyone ever finds it useful, am grateful. If not, it will help myself at least, when I need some revision.

Readers, feel free to comment if you’ve any alternative solutions, contrast views or a different problem all together. After all,

to err is human… to unforgive is Rust Compiler 😛

Install rust simply by typing in your terminal the following command:

$ curl -sSf | sh

If curl is not available, install the same: $ sudo apt install curl

Rust comes with a project manager — “Cargo”. Start a new project with cargo, in no time: $ cargo new hello_cargo --bin

Rust distinguishes the projects in to 2 types:
1. Executable (Default i.e. the argument --bin is optional)
2. Library (--lib instead of --bin)
Prior to v1.25, Library was default and Executable required the flag --bin.

cd into the new project “hello_cargo” and execute the code: cargo run

If you are facing the following error:linker `cc` not found, which is exactly what I’ve faced, then we are supposed to install any cc — gcc/clang. I preferred gcc to clang, and installed the same:
sudo apt install build-essential

Now, the hello_cargo project will execute perfectly.