One of the bases to be happy as a programmer is that the language we use every day gives us the least amount of headaches. If we review the latest stackoverflow surveys on developers we find that Rust is the most loved programming language by programmers. What is it about this language that makes programmers who have tried it happy? All of it despite still being a great unknown to many programmers.
Being the most loved and most popular language, it may still be at odds with other factors. We have already discussed the popularity of Python and the fact that it is not a relatively new language. With Rust we find ourselves with the case of being practically a newcomer and a great unknown for many programmers. Let’s find out in detail and see in which use cases it can help us in our daily work as programmers.
Mozilla needed Rust as the backbone of Servo in Firefox
Rust began to evolve thanks to the momentum of Firefox and that of a large number of community contributors, not just Mozilla.
Rust emerged in 2010 in Mozilla as a personal project of Graydon hoare in search of a language that would allow writing extremely fast code at the same level as C or C ++ but without the memory management problems which had historically led to being extremely meticulous not to commit serious bugs on memory access and run-time race conditions.
Mozilla was looking for an extremely secure language capable of supporting its demanding performance requirements. A) Yes Rust began to evolve thanks to the momentum of Firefox and that of a large number of community contributors, not just from Mozilla. Today, it forms an important part of the main core of the Servo browser engine used by Firefox, taking advantage of the benefits in terms of parallelism, concurrency and efficient memory management.
We recently talked about how Firefox Quatum CSS had achieved incredible render times. We owe this to Rust’s performance and its efficient and secure concurrency management. And the reduction of the number of bugs caused by situations such as, for example, race conditions.
Rust leads systems programming to modernity
When we talk about system programming, the first thing that comes to mind is that part of programming in which system administrators use scripts or small applications to lift machines. But beyond that, the system programming is much more extensive. is defined as the development of software elements that other applications will use as a basis. A good example is the one we mentioned earlier with Firefox and its Servo motor, and another very important is the Linux kernel written mainly in C / C ++.
Rust brings modern tools to the world of systems programming:
- Position. Your dependency manager and generation system builds. It is responsible for the compilation and management of components external to our code such as Rust libraries, called craters.
- Rustfmt is in charge of ensuring the consistency of the code style between developers.
- Rust Language Server facilitates integration with different IDEs to aid code completion by displaying messages inline error in the code.
We always relied on C or C ++ when we have needed tasks where performance is important. Not to say vital, as in embedded systems or high performance systems such as simulation. The search for a substitute has always led to slower alternatives, instead, Rust ensures excellent memory management as a great cornerstone along with modern syntax.
Its core values is Secure memory management guaranteed at compile time, using the concepts of ownership of the data used and memory borrowing. In addition to ensure at compile time that we will not encounter race conditions. All this through high-level abstractions with type inference, without cost in execution times, very close to the values that C / C ++ can reflect, even improved.
Rust is an excellent language to create command-line applications where we can define all the dependencies and generate the binary to be distributed through position. In addition to creating embedded applications at a very low cost in size with compile-time security from future errors. It also has a good system of error handling and of logging flexible in maintaining code.
Its core values are guaranteed secure memory management at compile time, using the concepts of data ownership and memory borrowing. In addition to ensuring at compilation times that we will not encounter race conditions
Rust also works for the Web, through WebAssembly and much more
The development community has been waiting for years on this fact: that Rust managed to be a multipurpose language and will also enter the world of web development, beyond the internal development of a browser. In this way, excellently documented, we find the web “Are we web yet ?: n directory of all the resources available today for use with Rust. If you did not know Rust yet, it is interesting to know how it has an excellent HTTP stack where we can use web frameworks like Rocket, even being able to replace Rails / Django or Flask in the near future.
It also has different tools to create APIs, database connectors, HTTP clients, CMS, logging systems, etc.
Projects using Rust in production: from distributed systems to embedded systems
Aside from Mozilla and its development on Firefox, the community of companies using Rust in production continues to grow. Thus we have some examples in different areas, such as Dropbox in which Rust is one of the key pieces in the efficiency of its data centers serving content to more than 500 million users.
On the other hand, Yelp has developed its own A / B testing framework taking advantage of Rust’s speed (at the same level as C) and more secure than it, which helps with its maintenance.
Recently Amazon joined in the development of Firecracker a lightweight virtualization system for serveless systems in the AWS cloud.
We also find Rust being part of some tools of RedHat as its new storage system, to Microsoft using it as part of the implementation of Azure for IoT, Reddit for the comment processing system or Twitter as part of the internal tools of the tooling.
Here you can check the companies and projects that have produced developments using Rust.
Even if Rust has a slightly rougher learning curve than other modern languages of which we have spoken, it has excellent documentation on its official website with fully guided resources, as well as various meetups. Here you can see an excellent video of the Madrid Meetup kick-off session, Madrust, where they explain some of the fundamental principles of Rust.
We can start with “the book” of Rust, as The Rust Programming Language written by Carol Nichols and Steve Klabnik is known, as well as other contributions from the Rust community.
There are a number of example exercises on the official Rust Github. Say also that in the roadmap Rust is planning to create more resources for novice and intermediate developers.
Perhaps Rust will be the language we use for the next 40 years replacing C / C ++.
More information | Rust