Rust :How To Start Programming language?

Rust Programming language

Rust is a multi-paradigm programming language concentrated on execution and safety, especially safe compatibility. Rust is syntactically similarly to Python, C++, Ruby, but supported memory safety without using automatic garbage collection(memory management.).

Developer: Mozilla
Website: www.rust-lang.org available pdf file
Implementation language : Rust
Filename extensions: rs,.rlib
Designed by: Graydon Hoare
Typing discipline: Inferred, affine, nominal, static, strong
Stable release: 1.43.1 / May 7, 2020; 16 days ago
Paradigms: Concurrent computing, Functional programming, Generic programming, Structured programming

Also you can Read full Information All About the Information of the rust wikipedia

Getting Started

Let’s start your Rust tutorial step by step! There’s a lot to learn, but every learn to starts rust download. In this section, We will talk about —!:

first of all You can Installing Rust on Linux OS, macOS, or Windows Operating system.
and then you can Writing a first program that prints like as a Hello, world! using Rust.
Now, Using cargo, Rust’s available package manager as well as full build system

Installation

The first of all you following the step is to install Rust. Simply u can download Rust via rustup, a simply command line tool like as a terminal (CMD) for managing Rust latest versions as well as updated associated tools. We will must required an internet Data connection for the download.

Installing rustup on Windows

Using rustup (Recommended) https://www.rust-lang.org/tools/install It looks like I am running macOS, Linux Operating system, or another Unix-like Operating system. To first of all download Rustup as well as step by step install Rust, execute the bellow in your CMD Like as terminal, after that bellow the on-screen instructions. bellow lots of the “Other Installation Methods” if you are on Windows run this commands.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Top Code Editors and IDE for Rust Development of 2020

simple you can Rust integration supported ide for your great editor of choice bellow list.

  • ATOM
  • EMACS
  • ECLIPSE
  • GEANY
  • INTELLIJ IDEA
  • SUBLIME TEXT 3
  • VIM
  • VS CODE

Installing rustup on Linux or macOS

If you’re using Linux Operating system or macOS, so you can step by step open a terminal on CMD as well as simple enter the bellow latest command:

$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh

Updating and Uninstalling

and then you have a installed Rust through rustup, simply updating to the new fresh version is simply. From your any os shell/ terminal, run the bellow update or Uninstalling script:

Updating

$ rustup update

Uninstalling

$ rustup self uninstall

How to check your Rust version?

Open the shell on your system. Page navigation to the main root directory of the Rust application. Now execute the bellow command to check the Rust version.To check whether you have Rust installed correctly, open a shell and enter this line:

$ rustc --version

Hello world example – Rust Programming Language

Open a terminal cmd as well as enter the bellow commands to create a Application folder with a folder for the “Hello, world!” app within the Application folder.

Creating a Project Directory

using for Linux, macOS, & PowerShell on Windows OS

$ mkdir ~/applications
$ cd ~/applications
$ mkdir hello_world
$ cd hello_world

Windows CMD

> mkdir "%USERPROFILE%\applications"
> cd /d "%USERPROFILE%\applications"
> mkdir hello_world
> cd hello_world

For here see sample example, use hello_world.rs rather than helloworld.rs.
Filename: main.rs

fn main() {
    println!("Hello, world!");
}

and then you have Save the file as well as go back to your CMD on your window.
On Linux or macOS

$ rustc main.rs
$ ./main
Hello, world!

On Windows

> rustc main.rs
> .\main.exe
Hello, world!

Factorial function

Here is a simple “Factorial” Example written in Rust. The println! using Recursive, Iterative and macro iterators prints the message to standard results.

Using Recursive

fn factorial(i: u64) -> u64 {
    match i {
        0 => 1,
        n => n * factorial(n-1)
    }
}

Using Iterative

fn factorial(i: u64) -> u64 {
    let mut acc = 1;
    for num in 2..=i {
        acc *= num;
    }
    acc
}

Using iterators

fn factorial(i: u64) -> u64 {
    (1..=i).product()
}

Rust Comparison

There are the bellow What is the difference between

  • rust vs go
  • rust vs c++
  • rust vs python

Comming Soon……..

Source Code

The all about source code files from which this great book is prepared can be get on GitHub platform.

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Rust Programming language.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment