DEV Community

Cover image for The Hidden Power of Rust
Nathan
Nathan

Posted on • Updated on

The Hidden Power of Rust

There are many programming languages out there, each with its own strengths and weaknesses. But what makes the Rust programming language so special?

Rust is a systems programming language that focuses on safety, security, and concurrency. It is sponsored by the Mozilla Foundation and is developed by a team of open source contributors.

Rust is designed to be a safe and concurrent language that is easy to learn and use. Rust achieves these goals by using a combination of static and dynamic typing, ownership, and borrowing.

Static typing helps to prevent errors at compile time, while dynamic typing allows for more flexibility and easier refactoring.

Image description
Ownership and borrowing help to ensure that data is accessed safely and efficiently.

Rust is also a very fast language, thanks to its strong focus on performance. It is able to achieve high performance without sacrificing safety or security.

In addition to all of these amazing features, Rust also has great tooling and a thriving community. The Rust team provides great documentation and there are many resources available to help you learn Rust.

Both Rust and C++ are systems programming languages that support low-level code, high performance, and direct memory access. They both provide control over memory management and allow for unsafe code. However, Rust is a newer language and has a more modern syntax and design, while C++ is an older language with a more complex syntax.

Although the Rust and C++ compilers are very different, it's easy to read a C++ program and get an idea of what it's doing. Rust is very different. It's more like a mixture of assembler and a functional programming language, and it looks very strange to the uninitiated.

Image description

In terms of code quality, Rust is way ahead of C++. The compiler is very strict and it catches a lot of errors that would normally go unnoticed. For example, in C++ you can have a variable that's never used, and the compiler will just ignore it. In Rust, the compiler will throw an error. This means that programs written in Rust are usually more reliable and have fewer bugs.

In terms of performance, Rust is also ahead of C++. The compiler is able to optimize the code better, and the resulting programs are usually faster.

Image description

So, if you're looking for a language that's more reliable and faster, Rust is a good choice.

Where to learn RUST?

First of all I strongly recommend to read the Official Rust book. If you prefer watching videos, there are some good ones on YouTube.

The best repo on github to learn RUST is https://github.com/ctjhoa/rust-learning. There is a collection of links to blog posts, articles, videos, and other resources for learning Rust.
Another interesting repo https://github.com/cis198-2016s/homework.

The Rust programming language is a great language for systems programming. It has a strong type system and provides a lot of safety and security features. It also has good performance.
If you are already familiar with RUST you can contribute to our Open-Source project following this guide https://github.com/blst-security/cherrybomb/blob/main/CONTRIBUTING.md.

Join our Rust Community on Discord : https://discord.gg/UkUFYECC

So what are you waiting for? Give Rust a try today!

Discussion (29)

Collapse
redoxeon profile image
Mike Harding

I'd also check out Exercism's rust track, it offers good learning exercises and mentoring for learning lots of languages, and it does a good job of teaching the concepts in each language it has :D

Collapse
nathan20 profile image
Nathan Author

Hey thank for sharing !

Collapse
tamusjroyce profile image
tamusjroyce

What is the hidden power of rust? It is in your title. If you had to say it was one thing, what would it be?

Collapse
ashkanmohammadi profile image
Amohammadi2

I think the variable ownership model is the hidden power of rust

Collapse
nathan20 profile image
Nathan Author

For me it is Performance !

Collapse
ajinkyax profile image
Ajinkya Borade

I have a love and hate relationship with Rust.
I love Rust and want to program with it, but the adoption speed is not that great, sadly I'm in web/software development where JavaScript and Kotlin dominates this side of the world.

Collapse
simeg profile image
Simon Egersand 🎈

Nice write up! As an avid Rust user (although far from professional) I believe you missed the most important quality of the language -- it's so much fun! I really enjoy writing Rust! It has nice modern features and the tooling around it (cargo, crates) are easy to use.

Collapse
glenn_miller_860ba12ffbf7 profile image
Glenn A Miller

Bagron was my go to guy on YouTube when I initially took up Rust. I learned so much from him. I can't recommend him highly enough.

Collapse
stephensmith9 profile image
Stephen Smith

Any link? A quick search on youtube or google does not return any results for 'bagron rust tutorials'.

Collapse
glenn_miller_860ba12ffbf7 profile image
Glenn A Miller
Thread Thread
stephensmith9 profile image
Stephen Smith

Thank you! These look awesome.

Collapse
jarrodhroberson profile image
Jarrod Roberson

"Rust is very different. It's more like a mixture of assembler and a functional programming language," tell me you have never written ASM or Functional code without telling me you have never written ASM or Functional Code.

Collapse
nathan20 profile image
Nathan Author • Edited on

Hmmmm

Collapse
samueljosephs profile image
SamuelJosephs

This is wrong, the c++ compiler is just as good as optimising as the rust compiler. If your using clang rust and C++ use the same backend (LLVM). Rust and C++ will put out binaries of the same speed and c++ binaries are normally smaller. Where on earth did you get this information? I love rust but this is just wrong.

Collapse
nathan20 profile image
Nathan Author

Actually C++ is generally faster than Rust in some scenario, but if you use certain safety features in Rust, it can start to slow down. However, the faster compilation speeds are worth the extra time, since it can help avoid difficult issues later on. Ultimately, it comes down to personal preference and what you're looking for in a language.
I think we are in agreement.

Collapse
suhaibali2002 profile image
suhaibali2002

great information but i think C++ best choice for Beginner's to know the Language basics

Collapse
nathan20 profile image
Nathan Author

Maybe you are right , Rust for beginners is little bit difficult

Collapse
5th profile image
Marius

clear and concise, love it!
tho i think you could've mentioned Rust by Exemple :)

Collapse
nathan20 profile image
Nathan Author

Thank you ! I will check it maybe I will mention it

Collapse
jwp profile image
John Peters

Does it allow for desktop applications? Can they easily host a browser?

Collapse
yassineldeeb profile image
Yassin Eldeeb 🦀 • Edited on

Definitely! But please keep in mind that Rust takes a lot of effort in the learning process, It's not as ruby, python or JS that you can start using and learn by practice cause I've done that first and it was an awful experience. I was like: "what does that mean for this to have short lifetime? Why you can't borrow something twice mutably? What's this trait thingy? the borrow checker makes no sense" If you came from a higher level language like me then there are a ton of low-level details that you'll be missing, recommend reading the rust lang book before starting a project, It's fantastic 👌

Collapse
nathan20 profile image
Nathan Author

I definitely agree with you ! I also learned some High level programming language like python js or even java, but the learning process for RUST is completely different and takes more time. At the end I am sure that is worth :)

Collapse
yassineldeeb profile image
Yassin Eldeeb 🦀 • Edited on

For the desktop application part then yeah, but keep in my mind that the ecosystem isn't very mature as if you would develop it with C++ or ElectronJS, that being said everything is possible with some workarounds and creative design patterns.

For a production example, check Deadliner

Collapse
nathan20 profile image
Nathan Author

Hi John rust is powerful backend language! Whatever which platform on the front

Collapse
jonathanriche profile image
Jonathan

Check out Tauri tauri.studio/

Collapse
rxmoein profile image
Info Comment hidden by post author - thread only accessible via permalink
Moein Hosseini

I see no important information here, you are not talking about power of rust you are just saying rust is better than cpp. And most of the time this kind of comparisons are for fun. In real world you may use any tool based on your needs. I was expecting more details about the rust itself, I don't really care about which one is better or not.

Collapse
g33ksuperstar profile image
g33ksuperstar

Rust is the overcomplication of safety. Zig is the simplicity of safety.

Collapse
masonharper profile image
Mason Marper

Thanks for sharing

Collapse
archnim profile image
archnim

If you want a language with the advantages of rust, but a much easier syntax, just switch to Nim 🤓
nim-lang.com

Some comments have been hidden by the post's author - find out more