On the Future of Web Development
It wasn’t always so clear, but the Rust programming language is fundamentally about empowerment: no matter what kind of code you are writing now, Rust empowers you to reach farther, to program with confidence in a wider variety of domains than you did before.
— The Rust programming language
Feel the Empowerment
Although Rust is considered a low-level programming language, it doesn’t always feel that way. While most people connect strongly-typed languages with a lot of type annotations and much more verbose code, with Rust, you can relax and let the compiler’s type inference handle most of the work. Sometimes this makes Rust feel like a dynamically typed language.
Its trait system helps building abstractions over complex types that come at no runtime cost. A trait is a kind of interface with associated methods, types, and constants.
For even more language magic there are macros. Rust’s macro system allows for slick DSLs while keeping the safety and speed of the language. For example, the method to print a line is a macro rather than a method. There is also a macro that makes it very easy to build a Vector of any kind:
Meet Yew. Yew is a modern Rust framework inspired by Elm and ReactJS. It lets you write powerful frontend web apps in Rust that run on WebAsssembly. It also provides a macro for writing components in a JSX-like syntax. This is also a great example for Rust’s powerful macro system.
Harness the ecosystem
Rust has a vast ecosystem that keeps growing. Despite its growth, the ecosystem is very stable because it is driven by a committed community. In fact, an integral part to Rust’s development is its openness. Every step of the development is publicly discussed and documented so everyone can take a look behind the curtains.
You know npmjs.com? Meet crates.io. Libraries in Rust are called crates. Just like npm packages you can install them when they offer a binary or add them as a dependency to your project and use them as a library. This part of the ecosystem is open as well. The website that powers crates.io as well as the package index are openly accessible on GitHub. Rust’s package manager cargo is built with due regard to a mixture of lessons learned from previous package managers as well as the works of Yehuda Katz, the creator of bundler. It is the central tool in the Rust world.
Documentation on-board. Rust comes with a built-in tool for generating documentation from Rust sources. The platform docs.rs automatically produces docs for existing crates and makes them searchable, so you get automatic documentation for almost every crate. You can find the official documentation for Rust on doc.rust-lang.org.
Keep track of your dependencies. If you are maintaining a huge crate with a lot of external dependencies, deps.rs helps you to keep track of all of them.
Deep-dive into the community
The community around Rust is incredible. The subreddit and the IRC channel (#rust on Mozilla IRC) are full of very helpful Rust developers of all tiers. There are tons of bloggers who write about their experiences with Rust. There are always so many things to do inside the Rust project, and everyone can join in and help develop future versions. Conferences like the RustFest in Europe and the RustConf in the US help to connect like-minded developers with similar levels of knowledge and help to spread the spirit of the language further. There are also many, many Meetups. Just check meetup.com for a Rust group close by.
Getting more familiar with the language is a solid investment. For a good starting point on Rust and WebAssembly take a look at this template project: https://github.com/rustwasm/rust_wasm_template.
Originally published at 9elements.com on July 11, 2018.