Rust meets Fedora

What is Rust?

Rust is a systems programming language which runs blazing fast , prevents almost all crashes , segfaults and data races.  Most of the people now would wonder exactly why do you require another programming language , we already have a lot of them.
I'll try to explain exactly why ..




Safety Vs Control

We have often seen this spectrum where , we have C/C++ which has more control of the hardware which it's running on , enabling the developer to optimize the performance by executing finer control over the assembly generated. However, this is not very safe; it's easier to segfault or to cause security bugs like heartbleed.

On the other hand ,  we have languages like Python , ruby and JS where the developer has very little control of what's going on but they are very safe . They can't get segfaults  , you can get exceptions but they are pretty contained . And somewhere in the middle , there's Java and few others which are good mixture of both - control of the hardware they run on and vulnerabilities don't show up much.

Rust is a bit different . Rust doesn't fall in the given spectrum. It gives the developer all the safety and the control.

Specialties of Rust

Well, Rust is a systems programming language like C/C++ but unlike those what it gives the developer fine grained control over memory allocations . Garbage collector is not required anymore . It has a minimal runtime and it's very close to the bare metal . What it implies is , the developer is guaranteed about the performance of the code and also , anyone who knows C/C++ can understand and reason with a rust code.
Rust runs blazing fast , since Rust is a compile language with  LLVM as it's backend and it taps in to a large suite of optimizations. In a lot of areas rust can do better than C/C++ . 

Rust is safe by default , Rust like JS , Ruby and python is safe by default which means you can't have segfaults , dangling pointers or null pointers .

One of very important feature of Rust is it eliminates data races ,  now a days we have computers with tons of cores and many threads running in parallel  but it's really tough to write parallel code , what elimination of data races does is it simply assures the developer can't write wrong parallel code.

 Two Key concepts which eliminates data races :

Ownership :
Variables are moved to new locations, preventing the previous location from using it.There is only every one owner of data!

Borrowing :Owned values can be borrowed in Rust to allow usage for a certain period of time.


In Fedora 25 & 24

You can do   dnf install rust and get started with rust. Here's the demo program on Fedora 25.

                            

I have created a simply program to print a statement because printing "hello world" is too mainstream .
                               


                          That's how I execute it and get the the printed message.


Want to contribute to testing in Fedora for Rust
Execute : sudo dnf --enablerepo=updates-testing --refresh --best install rust

Fedora 24 https://bodhi.fedoraproject.org/updates/FEDORA-2016-c5a0802802
Feodra 25 https://bodhi.fedoraproject.org/updates/FEDORA-2016-08169a6354

Drop us a mail at test@lists.fedoraproject.org or #fedora-qa over freenode to get started!

Comments

Popular posts from this blog

Rocket on Fedora

How to create live USB with Fedora Media Writer on Windows 8.1

Kernel testing made easy!