Recs.
Updated
Rust is a system programming language that runs fast and prevents crashes and data race conditions. It features "guaranteed memory safety".
SpecsUpdate
Pros
Pro Built-in package manager
Rust features a NPM-like package manager that allows Rust developers to easily import crates from Crates.io into their projects, and automatically handles dependency resolution while building your project. Cargo handles every process of project management from the creation of projects, building debug and release builds, documenting your project and all of the libraries your project has imported, initializing your project with git, formatting the style of the code, and the ability to add extra subcommands for additional features just by installing them, such as cargo clippy.
Pro Friendly community & Code of Conduct
The Rust Code of Conduct promotes a safe, friendly, and welcoming environment for newcomers to Rust and programming in general.
Pro Threads without data races
Unique ownership system guarantees a mutable data to be owned and mutated by only one thread at a time, so there's no data race, and this guarantee is checked at compile time statically. Which means easy multi-threading.
Of course, immutable data can be shared among multiple threads freely.
However, deadlocks are still perfectly possible within 100% safe Rust.
Pro Makes developers write optimal code
Rust is a modern programming language written around systems. It was designed from the ground up this way. It's language design makes developers write optimal code almost all the time, meaning you don't have to fully know and understand the compiler's source code in order to optimize your program.
Furthermore, Rust does not copy from memory unnecessarily, to give an example: all types move by default and not copy. Even references to types do not copy by default. In other words, setting a reference to another reference destroys the original one unless it's stated otherwise.
Pro Supports cross compilation for different architectures
Since Rust 1.8 you can install additional versions of the standard library for different targets using rustup/multirust. For example:
$ rustup target add x86_64-unknown-linux-musl
Which then allows for:
$ cargo build --target x86_64-unknown-linux-musl
Pro Beautiful, in-depth, automatically-generated HTML-based documentation
Rust has amazing documentation on their website, which can be automatically generated on your own development system just by issuing the cargo doc
command in your project directory and navigating to target/doc
. This documentation provides a webpage whereby you can use the search feature to find the exact bit of API documentation that you want. Many crates on Crates.io host their generated documentation online which carefully describes every piece of public code in their project, automatically generated by Markdown syntax in code comments.
Pro Excellent IDE Support
Rust has amazing support for code completion and linting with the Tokamak plugin for Atom, combined with racer and cargo-clippy for code completion and a large repository of additional lints for cargo. In addition, Microsoft Visual Studio Code has great support for Rust via RustyCode.
Pro Teaches memory management
Introduces low-level concepts from the beginning, while providing giving helpful errors that help teach why certain things must be done a certain way. Compared with C, it prevents beginners from writing code which works but unintentionally relies on undefined behaviour.
Cons
Con Advanced concepts are not beginner-friendly
To program even basic things in Rust, a beginner learning their first language has to develop an understanding of references, pointers, ownership, borrowing, lifetimes, scope. This is on top of many other programming concepts. In Rust, there is not much that can be written in a naive manner.
Con Rust not as safe as it pretends to be
Rust problems:
1) Massive undisclosed usage of unsafe.
2) Massive amounts of memory safety CVEs - see details.
3) Large bloated Rust binaries increase attack surface for exploits.
4) Many corporate types claiming Rust is safe, don't actually program or use it (have some quiet financial interest to push it).
Con Not as useful or productive as advertised
If really out here wanting to use something besides C/C++, in 98% of use cases, would do just as well or be better off using something other than Rust. Will complete the project faster, would be easier, will be happier, and nearly as safe (use newer language with optional GC).
Con Hard to install on Windows
Especially compared to Go for which is was sufficient to unpack somewhere, add the env vars GOROOT and GOPATH. The (terminal-based) installation recommends in red text to use Visual Studio code, but it is possible to install using GNU tools according to this. Not very beginner friendly.
Recommendations
Comments
Flagged Pros + Cons
Pro Supports cross compilation for different architectures
Since Rust 1.8 you can install additional versions of the standard library for different targets using rustup/multirust
.
For example:
$ rustup target add x86_64-unknown-linux-musl
Which then allows for:
$ cargo build --target x86_64-unknown-linux-musl
Con Confusing installation on Windows
The (terminal-based) installation recommends in red text to use Visual Studio code, but it is possible to install using GNU tools according to this. Not very beginner friendly.
Out of Date Pros + Cons
Con Hard to find learning resources or libraries
Because it's still a relatively new language, Rust does not enjoy a following as large as other languages/environments. Rust development has also been rather volatile for a long time during the beginning of the development of the language adding to this issue.
Because of the small community, it's harder to find useful libraries for projects or any other kind of resource.