Rust wide web (2/5)

Rust wide web (2/5)
Ruben has experience with a lot (and I mean a lot) of programming languages. When I asked which ones, he could name 21 off the top of his head. He loves experimenting with them, seeing what each can and can’t do. What makes a language unique? What can one language do better than the other? Why was Ruben the one to first evangelize Rust within Tweede golf? Let’s ask him!

This is part 2 of 5 of our series "Why we love Rust". Check out the complete series here

All those languages… What made Rust pop out?
Having a language with procedural elements (like with C) that is statically typed, and that is memory safe without using a garbage collector is a new concept, that excites me the most. Manual memory management without any checks is really hard, most languages opt for a runtime garbage collector (incurring some runtime overhead). Meanwhile Rust has language semantics that allow it to check and bake memory management into your program at compile time using the borrow checker. Rust’s memory-safety is baked in the compiler with it’s borrow checker.

That’s cool and all, but I’m like… super productive in C++. I don’t have time to fight that “borrow checker” of yours.
Sure, but unfortunately most programmers are human and humans make mistakes. While you have concepts like RAII in languages like C++, which help you with memory management, the compiler doesn’t actually enforce it. The Rust compiler makes sure there is always only one owner of a resource and enforces responsibility for that resource. It is simply impossible to access already freed memory without the compiler yelling at you for it first. So all the time we are spending hunting those runtime memory-related issues is now spent actually working on the problem we are trying to solve.

Need an introduction to Rust?
Ruben did an introductory talk (dutch) about Rust back in 2016. The nice thing about it, is that the talk is still quite relevant, as many of the topics discussed still apply as of today. A lot of features he promises to be implemented somewhere in the future are now actually released, so if you speak Dutch, definitely check it out!

What is your most recent Rust project?
Currently I’m evaluating if Rocket is viable as one of Tweede golf’s standard web frameworks. Rocket’s ecosystem hasn’t reached full maturity yet, so there are still things we would have to write ourselves, but new, useful crates are released monthly. We’re almost at a point where most REST APIs are pretty viable to create in Rust, albeit with a somewhat high learning curve. In the future I expect this to only become easier.

Ruben’s takeaway
Rust learned from one of Node.js’s problems around package repositories. Crate versions on crates.io are permanent. A certain version cannot be deleted or overwritten, so you’ll be guaranteed that when you depend on a certain version of a crate, that version’s code will always be the same.

Will Rust become *the language of the web?*
That’s a tough one. Working with the web means handling a lot of string based or unstructured input, which doesn't work well when all you really have are strictly defined types. It's definitely manageable, but not as easy as slapping some strings together in Javascript or PHP. Also, because of the way ownership and callbacks work, it’s not a perfect language for UI programming (although it’s definitely not impossible when looking at games that are currently being made in Rust). On the other hand, the small memory footprint, great error handling and features like async/await, make it perfect for certain web services. Let’s also not forget the amount of work being done around webassembly. Rust is a well-structured, well-thought-out, well-planned language, so it’s definitely a language we should want on the web!

More by Ruben
A blog post about Instant data retrieval from large point clouds

Stay up-to-date

Stay up-to-date with our work and blog posts?

Related articles

The number of data centers worldwide is constantly increasing, and so is their electricity consumption. One way to become more power-efficient is certainly the constant development of better hardware, but we as developers should do our share. This post shows how coding in Rust can help to use existing resources more efficiently, to help preserve our planet — at least a little bit.
In February of 2024, I was invited by Matthias Endler of Corrode to join him on his podcast Rust in Production. We discussed how Tweede golf uses Rust in production, to ensure the safety and security of critical infrastructure software.

If one person at Tweede golf is a Rustacean, it’s definitely Wouter. Whether it’s about web, embedded, or even games: he tried it. And probably not just tried it, but prototyped, created, documented, presented, and nailed it. Just take a look at Wouter’s GitHub page[1]. He’s also engaged in the Rust community as an organizer of RustFest, member of the Dutch Rust foundation, and as maintainer of several open-source crates. He believes that Rust is well on its way to perfection.