So I've only been exploring Rust seriously for the past couple of weeks, but I already see some pretty amazing things happening. I've started learning about how it works server-side with Actix Web and how it can run game scripts with Godot or even whole new Rust engines like Bevy (though those are still in beta for the most part).
What I've been the most excited about, however, is the possibility of using Rust for web development. Javascript has, to put it mildly, invoked a lot of ire in the web development community over the years. Its dynamic type system is notorious for creating runtime errors that the compiler doesn't have the necessary information to catch prior to a deployment. These errors are one of the major reasons that large-scale Javascript teams often have to spend almost as much time, energy, and manpower on testing as they do on the development itself.
Rust, on the other hand, has a beautiful set of features collectively known in The Rust Book as Ownership and Lifetimes. These concepts work together to form Rust's highly specific rules surrounding memory management of variables. These rules, without diving too deep into the ampersands and double colons, serve to ensure that if any variables are accessed at a time when they may not contain the expected value, the compiler will be aware of the fact and request a confirmation in the form of some identifier for the unsafe behavior or suggest an alternate approach to retrieving the value, all before the code ever actually runs incorrectly!
And now, we may finally be to the point where we can get these guarantees for web development! While Yew is still in beta and as such isn't stable enough for production builds yet, it appears to be an extremely smooth workflow. Build times are extremely reasonable. The directory sizes are entirely manageable. The only slight performance issue seems to be the time required to build the initial page content from the web assembly and Javascript, but once it is built, everything operates at excellent speeds as one would expect from memory-safe Rust code.
Below are links to a hosted demo of a calculator I built with Yew and a Github repo for it. While it is unfortunately not production ready, my hope is to generate more interest in Yew's development and external support so that it has an easier time getting off the ground. It will be a great relief to leave web development in Javascript behind, but until then, thanks Web Assembly!
Top comments (0)