In 2015 version 1.0 of the Rust language was released. Since then, Rust has gone from strength to strength. But what's so great about Rust? Let's take a look!
03-07-2024
Rust began as a personal project in 2006 by Graydon Hoare while at Mozilla Research. By 2009 interest in Rust had really gained momentum, and Mozilla began sponsoring it as part of the Servo project (an experimental browser engine).
Over the next 10 years Mozilla continued to nurture Rust development and employed fulltime engineers to help develop it further. It went through several iterations such as 0.2, 0.3 and 0.4 which evolved and refined the concepts present in the language today – at that point though, a lack of consistency due to backwards compatibility issues between iterations help up adoption of Rust.
Of course, these early releases were 0.x versions and so were not deemed ready for production systems. However, by the 2010s, Rust was attracting volunteers (both from tech companies and academia alike) from around the world to help with its development.
The first stable release of Rust was in 2015 with Rust 1.0 being released on the 15th of May that year. Since then, Rust has gone from strength to strength.
What is Rust?
If you've only heard of Rust in passing, you may have many questions. Is it an Object Oriented language? A functional language? Is it an interpreted or compiled language? Is it dynamically typed or is it statically typed? How strong, in terms of type safety, is the Rust language?
If you're short of time, Rust is:
A compiled language
A strongly typed language
A multi-paradigm language - meaning that you can program in different styles (Structured, similar to Object Oriented; Functional; Imperative...).
A memory safe language; that is, all references point to valid memory
A garbage collector-free language which means that it generally faster than other memory safe, OO languages
A highly performant language with performance one of its main goals
A language which supports safe concurrency
How popular is Rust?
Back in 2019, 2020 and 2021 Rust ranked as the 21st, 19th
and 16th
most popular language respectively in the annual StackOverflow developer surveys. More recently, the StackOverflow surveys of 2022 and 2023 placed Rust 14th which shows a gradual but steady increase in its popularity.
Interestingly amongst those ‘learning to program’ in 2023 it is ranked 12th and there is a general trend that once someone learns to program in RIUST they want to keep using it.
The StackOverflow Developer Survey has also named Rust as the most loved programming language every year from 2016 through to 2023. In 2023 in the same survey, Rust was the 6th most wanted technology.
Why is Rust so popular?
The short answer here is that it not only provides very good performance, it also removes the pain points present in several other competing languages. Depending upon the particular language concerned these pain points relate to the lack of a garbage collector, type safety and memory safety (with null pointers being illegal) and flexibility in programming style.
At the heart of the Rust system is its approach to memory management. Older, and typically lower-level programming languages, such as C and C++ require the programmer to manage the memory they are using and to keep track of what items in their programs are being used and which are not, and to free memory up if it is no longer being used (as well as to avoid ready memory areas that are not part of the data item being managed). This can lead to very fast efficient programs but can also lead to many different bugs or errors occurring in programs relating to poorly managed memory and memory access.
In contrast, many modern programming languages such as Java and C# employed an automated memory management system approach, in which the runtime execution environment keeps track of what is using memory - and when memory becomes scarce will run a garbage collection process that clears out unused memory. Whilst this approach does not guarantee that a program will not contain memory leaks of one form or another, they tend to be at the Application Logic level. not at the lower memory management level. This is generally considered a safer approach. However, this approach is not without its own costs and thus is is a consideration when it comes to the overall performance of the resulting applications.
Rust takes a different approach; it has dispensed with a garbage collection and instead works on a different model of ownership. Ownership essentially means that there is only ever one owner of a value (in memory). At compile time, each value created must have exactly one owner. Values can be copied but the new copy has a new owner. Values can be borrowed; that is, temporarily passed to a different holder (e.g. in a function) before being returned to the owner. Thus, the owner of a value has sole responsibility for its use and deallocation (from memory). When a value goes out of scope it is removed (dropped) from memory.
As part of this approach, Rust imposes stringent rules on the programmer relating to how data is used or copied within a program; but once these rules are learned the result is a safer faster implementation.
The result is a very fast runtime, with no garbage collection overheads, which is also string typed and memory safe!
Does Rust replace C / C++?
Rust isn’t really a replacement for C as it has more in common with C++ than C. However, it is a direct competitor to C++ and real-world challenges in both C and C++ were motivating factors in the design of the language.
Will it replace C and C++ ? Honestly, probably not in the immediate future; so many organisations have so much investment in C/C++ skills, libraries and applications that there is very little chance of these languages disappearing overnight. In the long term though, well that's another question; it is quite possible that Rust will replace at least C++ as it has a similar syntax (although a little less verbose), similar performance, but with greater safety guarantees and built in support for concurrency.
Realistic Use Cases
It is interesting to consider that the first real use of Rust was the creation of a performant programming language that could be used as part of an experimental browser engine called Servo. This might lead you to think that Rust would be used to build browser-based applications, GUI applications or at the very least something related to the internet...however, Rust is probably most popular within the Systems Programming community right now.
This is where Rust shows to be growing very rapidly in popularity; it is used for applications in which C and C++ have traditionally been used, and indeed it is now supported directly by the Linux Operating System. In fact, you would be forgiven for thinking that it is only a systems level programming language if you have been reading much of the hype around the language.
However, Rust is not specifically a systems level language – it just happens to be very good as such; it is also used in browsers such as Mozilla Firefox and more recently by Google in Chrome OS and subsequently by their Chrome browser.
Interestingly, Rust looks very useful as a games language, and there are several games platforms that explicitly use Rust such as Bevy, Fyrox, and Piston. Godot is also worth an honourable mention as it is possible to use Rust - although this does involve a bit more work that just installing Godot (as you need to use the godot-rust project bindings). However, it should be stated that none of the big commercial games companies appear to be adopting Rust at any scale at present; C++ and C# (thanks to Unity) are still far more popular.
Who uses Rust?
Rust is now very widely used; those companies explicitly stating its use include Amazon, Discord, Google, Mozilla, Meta and Microsoft (remember the hoo-ha about Rust vs C#?). Also in December 2022, Rust joined C and Assembly Language in being one of the directly supported languages in the Linux Kernel.
Rust Foundation
The Rust Foundation looks after the Rust project as a legal entity and managed trademarks and assets. It was formed on February 8th 2021, following layoffs at Mozilla which could have put the Rust project at risk. There were five founding companies involved; these were AWS, Google, Microsoft, Mozilla and Huawei. The Foundations board is chaired by Shane Miller.
The Rust Foundation has not been without controversy, back in late 2021 the Moderation Team, whose responsibility was to ensure that community standards and Codes of Conduct were being followed, announced their mass resignation as a result of the Core Team “placing themselves unaccountable to anyone but themselves”. This led to governance reforms in May 2022 supported by the Core Team and certain members of the Rust Foundation board.
Rust Ecosystem
There is tooling provided with Rust to help manage toolchains and dependencies. When you install Rust you also get access to rustup which is an installer for Rust. There is also Cargo which is a command line tool to manage dependencies, run tests, generate documentation etc. Cargo works with Creates which are essentially installable modules. Creates can be stored on the Cargo server to be shared with other developers / teams. Cargo then provides a search function to allow Creates to be found. To see what is available for Rust via Cargo see the Cargo server site cargo.io. Currently there are nearly 150,000 different creates available.
In addition to the built in tools there is an active Rust community that have developed additional tolls such as clippy a lint like tool an rustfmt a formatting tool.
Rust Negatives
As mentioned above, Rust imposes significant restrictions on what you can and cant do with a value and this can lead to something of a learning curve. One comment often heard from Rust developers is that they seem to be fighting the borrow checker – which is usually a sign that some aspect of Rusts rules on value ownership are being broken and the developer is not clear on why.
However, this learning curve isn’t as steep as it may at first appear as there is excellent documentation available as well as online course s and in person training available.
Another negative relating to Rust is that the eco system mentioned above is less mature than some other languages such as Java, Python and C#. This is partly a reflection on the third negative for Rust that the community of Rust developers is still developing (at least when compared to those of languages such as Java, C and C++).
Summary
So where does that leave you if you are interested in Rust? Well, it is a language that is growing in popularity and that trend looks unlikely to be reversed. It is a language which has some element of a learning curve due to its strict rules but given all the documentation and suitable training materials (such as instructor lead courses) it is not that difficult to pick up.
The Rust job market seems very buoyant at the moment as it is still a young language and there are relatively, not that many skilled Rust developers out there. The negative side of this is that there are probably, in total, less Rust jobs out there compared to say Java or indeed C++.
Overall, the landscape for a prospective Rust developer looks bright, at least for the next few years – so if you are thinking of taking the plunge have a go!
Would you like to know more?
Have a look at our Rust Training Course and get in touch if you would like to discuss customising a Rust workshop to focus on your project's use case.
To help raise awareness of challenges and vulnerabilities and ways to reduce risk, we've got a bumper crop of cyber security blog articles. We've also got a robust range of hands-on training courses covering security for non-technical staff and IT professionals
We use cookies on our website to provide you with the best user experience. If you're happy with this please continue to use the site as normal. For more information please see our Privacy Policy.