Rust is a general purpose, compiled programming language sponsored by Mozilla Research. The Rust language grew out of a project done by Graydon Hoare, who was an employee in Mozilla. Its alpha release was in January 2012, however, its stable release occurred on May 15, 2015. Within only a few years, Rust became the most favorite programming language for a large number of people. By 2015 it became third most loved programming language according to the survey by StackOverflow. And last year Rust became the most loved programming language holding its position at first. What might be the reason behind this rapid success? Let's see some of the amazing strengths of Rust.
The Rust language is designed to handle functional, imperative, structured and generic approaches. Its major goals are Safety, Concurrency, and Speed. Rust is trying to become a language that is able to create very much safety and high concurrency by managing memory in a controlled manner, but programming in large. We all know that C and C++ have been holding the position of extremely powerful programming language for a long time. Because of ‘Rusting’ power of Rust, it's likely a good time to change the priorities, maybe not today but in immediate future. Rust is likely to overpower C and C++ by taking shape of the same or much powerful than that.
The performance of Rust with C and C++ are almost comparable. There are several situations where rust is trying to take the form of C and C++. First of all, The syntax of Rust is similar to that of C and C++. The similarity in syntax directly refers to similarity in keywords. Yeah, Of Course, so many keywords in Rust, C and C++ are similar, But not all keywords in C and C++ are present in Rust. For example, in C++ we use ‘switch’, while here in rust we use ‘match’. Still, semantically Rust is very much different from C and C++.
Now talking about more important stuff in Rust, which comes as a part of Memory. The Rust is planned to be more memory safe. Rust has avoided the use of automated garbage collection techniques which is highly used in Java and Go. Well as mentioned earlier, rust is more of a follower of C & C++. Rust uses RAII(Resource acquisition is initialization), similar to C and C++ in memory. Also, stuff like the null pointer and dangling pointers are not real stories here. In Rust, we don’t have to deal with pointer arithmetic or manage memory. Here a particular amount of memory is allocated or reserved. So, on accessing an object, it's almost impossible to access a memory that is other than the desired one.Also, memory de-allocation is automatically done.In short, a developer doesn't need to deal with memory at all.
What about the safety of Rust? Of Course, Rust scores again. It's one of the primary goals of Rust. A “safe code mechanism” is used from beginning to end code. Safety is good, but sometimes too much of safety is not desirable. Rust provides you best of both worlds. By default the code in rust is safe. Being safe means too much of restrictions. There are situations where these restrictions become limitations. Well, Rust has overseen this limitation and has already found ‘unsafe’ as a remedy. By using an unsafe keyword, rust can handle situations like deadlocks, memory overflow, etc.
Rust is fairly complex, not as easy as GO language, after all, simplicity is not a primary goal of Rust. It's not that much an easy language, but still, it became the most loved programming language with very short span. Also, its execution rate is almost comparable to that of C and C++. The Rust is able to do most of the stuff that can be done with C and C++. This language is going to take us far more to the future, raising a threat to the very existence of C and C++