Andre Bogus - My Rust Story
Another one bites the… Rust 😉 Rust has consistently been voted the most loved programming language in Stack Overflow Developer surveys. Let’s see why through the eyes of Rust community leaders.
Time for our next My Rust Story blog! Andre Bogus is a Rust contributor and mentor, This Week in Rust editor and Clippy maintainer.
How did you first get introduced to Rust, and what were your initial thoughts about it?
As a programming language aficionado, I watch for new developments. Before starting with Rust, I learned a new language every one or two years. So, in 2014, I looked at the development process and liked its openness. It was not until 2015 (shortly before 1.0) that I wrote my first code: the eq_op lint, which is still part of clippy today.
Can you share a moment when you realized, “Wow, Rust is amazing”? What features or capabilities of Rust made you feel that way?
Damn, there are too many to count. The first was me finishing a lint in a programming language I had just spent a few hours learning. I got it to compile, and it worked on the first attempt. Another was seeing rayon prototypes and comparing that to Java streams (which do the same thing with more overhead and more restrictions). And I always get a kick from reading the compiler’s error messages; they’re great. Not to forget the very helpful community.
How has Rust influenced the way you approach solving programming challenges?
Designing a misuse-resistant API is certainly easier in Rust than in other languages because one can use the borrow checker to enforce the lifetimes of objects. Also enums are the best thing since sliced bread.
If you could add a new feature to Rust, what would it be, and how do you think it would benefit developers?
I have added a number of features to Rust, the first being the #[deprecated]
annotation, which was my first successful RFC and implementation. I also wrote code to allow doctests to just return a Result without a main()-function. The most recent thing I did was the Option::as_slice
method. One thing that I’ve not done yet I’d like to see is write-only references, which would make the uninit/assumed-init distinction of MaybeUninit part of the type state and thus give us a safe way to work with uninitialized data.
What’s your favorite programming meme?
There’s also a game called Rust, which leads some people to confuse the game and the language, so why not add to the confusion?
What tools and libraries do you rely on when working as a software developer?
Well, of course, rustc, cargo and rustup for compiler, build system and updater.
My editor/IDE of choice is helix, and I use git for version control.
There are so many great libraries that it’s hard to find a good subset to shout out, but regex, serde, tokio, sqlx, fst, roaring, rayon, clap, itertools, parking_lot, criterion, proptest, and insta certainly deserve it.
Tell us about a time when Rust made a significant difference in a real-world project
Until the pandemic, I was the VP of Engineering at Aleph Alpha, and our resident ML expert had written a Python script to scrub some data (of which we had a few GBs). He also included an estimation function that told us that his script would run for roughly a week. Well, we didn’t have a week, so it took me less than an hour to port the script to Rust. The Rust program finished in roughly ten minutes.
How has the Rust community shaped your programming journey? Are there any standout interactions or stories of support you'd like to share?
This is really hard because there are so many stories I can tell.
- Rust is the first language I was able to help develop. I wouldn’t have expected to do this in another language (especially not in a low-level language like, say, C or C++). The open development process is really great.
- I once tweeted that I’d like a rust-analyzer to be able to click on a test to run it, and the next day, it was implemented.
- The Rust community has been very kind to me, I’ve decided to pay it forward by becoming a Rust Mentor and also a This Week in Rust editor.
Did you experience any funny or embarrassing moments while learning Rust?
You know what’s funny? Me getting lots of clippy warnings. From lints that I personally wrote. That’s ok though, this way I don’t need to keep it all in my head.
What advice would you give to someone just starting out with Rust?
Don’t try to make it perfect the first time. Get something to compile (because, as we know, that’ll usually work, too). You can always improve it later. Also, try to learn how to effectively use the provided data types and your own structs and enums. Finally, don’t worry too much about lifetimes and ownership until you run into error messages because the compiler has your back anyway.
How have you seen Rust evolve over the years, particularly in your area of work?
As my first foray into Rust was writing lints, I was on nightly most of the time. So, I saw the early experiments for what became derives, proc macros and async/await. Especially the latter is now far more complete than in the beginning.
What do you predict for the future of Rust over the next decade?
Rust will continue to evolve, albeit likely at a reduced pace, as the existing implementation calcifies, making it harder to change things. The community will certainly grow further (given the newfound interest in memory safety from the White House, as well as various consumer advocacy groups). Some new features we’ve waited for in the last years will finally be stabilized (I hold out for the never type, some kind of specialization, proc-macro-expand and the new range type).
Is Rust only for systems programming, or do you see it as a valuable technology in other areas as well?
Rust is the only all level language I know of. We have long sought to find such a language by going down from the high level (think about Java, C#, Go, etc.). Still, those always require a runtime (although Go’s runtime is pretty lean, and GraalVM can do surprising things with Java byte code), which always precludes full control over memory layout and thus limits how low one can go. Rust, conversely, started low level and evolved abstractions on top that are of comparable quality to anything you’ll find in those other high level languages. This is great because I no longer have to bind a scripting language for my high-level code. For example, I can write a low-level parser with all the SIMD shenanigans I desire to really eke out the last bit of performance but have a simple iterator interface on top that gets all the goodies of that trait for free. So, on top of that, I can write simple loops or filter
, map
, fold
, etc. combinations as if it was a functional language. And the whole thing compiles down to something that is (to quote the meme) blazingly fast while being easy enough to maintain.
In February, Lars Bergstrom of Google unveiled a study that showed that Rust and Go engineers enjoyed roughly double the development speed of their C++ counterparts, and the Rust engineers were more than 80% certain their code works as expected. So I am not completely sure how this compares to other languages out in the field, but my hunch is that Rust can be a win almost everywhere. In my 2018 blog post “Corner Cutting vs. Productivity”, I posited that Rust front-loads a lot of complexity because it doesn’t let you cut corners. This means that while you can expect to be slowed down (by how much depends on some factors, including your proficiency with Rust) during the initial writing of the code, you gain that time back with interest during debugging, maintenance, and refactoring.
Finally, by building thread-safety right from the start, Rust enjoys a benefit in any application where you want to make use of the available hardware (because, unless you’re doing retrocomputing, that’s going to be multicore). This is something most non-functional programming languages (e.g., Java, Python, etc.) cannot match.
Rustikon
Curious to meet Rustaceans in person? Don’t miss Rustikon - the first Rust conference in Poland! Secure your spot now and we'll see you in March :)
Check other #MyRustStory: