Rust is Officially in the Linux Kernel
Today’s Issue: Designing Error Types in Rust Libraries, 10 Years of Betting on Rust, and C++ to Rust Phrasebook
Hello Rustaceans!
Welcome to another edition of the Rust Bytes newsletter.
In this issue, we’ll discuss Rust’s inclusion in the latest release of Linux kernel, present a Rust challenge for you, spotlight an amazing Rust project, and share some incredible links of the week.
Here’s issue 70 for you!
THE MAIN THING
Rust is Officially in the Linux Kernel
Remember all that heated debate? The online skirmishes, the passionate defenses, the occasional developer rage-quit?
It was a glorious spectacle of keyboard warriors, all vying for the soul of the Linux kernel. Well, folks, the dust has settled (for now), and Rust has officially landed a significant punch.
Last week, with the release of Linux 6.15, something truly spicy happened. Linus Torvalds, the benevolent dictator of the kernel (who, by the way, almost delayed the party due to a last-minute bug), announced the stable release.
And buried within the release notes, like a golden easter egg for us nerds, was the revelation: a Rust-based driver has officially made it into the mainline kernel.
This isn't just some forgotten utility driver nobody cares about, mind you. We're talking about the Direct Rendering Manager (DRM) driver, cleverly named NOVA. And get this: NOVA is gunning to replace the existing third-party open-source Nouveau Nvidia drivers.
That's right, Rust is now flexing its muscles to empower NVIDIA's next-gen open-source graphics hardware, specifically targeting their RTX 2000 "Turing" series and newer GPUs.
Why This is a Big Deal (and Not Just for Rust Fanboys)
Okay, so why should a non-programmer care about some low-level kernel shenanigans? Simple: reliability and performance.
While you might not be writing kernel drivers in your day-to-day, a more stable and performant underlying OS ultimately benefits everyone, including frontend wizards who just want their animations to render smoothly without feeling like a PowerPoint presentation from 2003.
And who knows, maybe one day your super-slick React app will be running on a kernel where the graphics driver is written in a language that actually cares about not crashing. A developer can dream, right?
RUST CHALLENGE 🦀
Last week, we shared a Rust tip about an attribute that, when applied to functions or types, ensures their returned Result or Option is properly handled.
Let's move on to this week’s challenge.
Find Peaks and Valleys
Given an immutable array of integers, identify peaks (elements strictly greater than both neighbors) and valleys (elements strictly less than both neighbors). Elements at the very beginning or end of the array (which only have one neighbor) cannot be peaks or valleys.
Your task is to return a Vec<usize>
containing the 0-indexed positions of all peaks and valleys in the array. The returned indices should be sorted in ascending order.
You can start writing and testing your solution on Rust Playground. Once completed, please share your solution and tag us either on X, BlueSky, Mastodon, or reply to this email.
PROJECT SPOTLIGHT 💡
Fornjot
Fornjot is an early-stage Computer-Aided Design (CAD) kernel designed to provide a foundation for developers building mechanical CAD applications.
Fornjot uses boundary representation (b-rep) to enable precise and reliable 3D modeling.
With its focus on code-first CAD modeling, it aims to allow you to create special-purpose tools, third-party libraries, or fully-featured CAD applications for industries like 3D printing, machining, and woodworking.
Fornjot stands out due to its thoughtful design and feature set:
Modular Architecture - Fornjot is composed of distinct libraries (fj, fj-math, fj-core, fj-export, fj-viewer, fj-window, and fj-interop), allowing you to use only the components you need for your specific use case.
Code-First CAD Modeling - You can define models programmatically in Rust, with support for third-party APIs to extend this capability to other languages, making it ideal for automation and custom workflows.
Focus on Mechanical CAD - Tailored for applications like 3D printing and machining, Fornjot prioritizes features and optimizations relevant to these domains, ensuring practical utility.
Export and Visualization Capabilities - Fornjot supports exporting models to formats like 3MF and includes a viewer for displaying models, streamlining the development and testing process.
Fornjot is still in development, best suited for simple models, but its active experimental projects (like CommandCAD and bevy_mod_fornjot), and growing community signal a promising future for this CAD kernel.
The project is open-source too on GitHub at https://github.com/hannobraun/fornjot.
AWESOME LINKS OF THE WEEK 🔗
Apiraino from Rust Compiler Ops team gives us a sneak peek behind the scenes in 'A glance at compiler team operations,' showcasing their tireless efforts from squashing pesky regressions to making sure the Rust Project's gears are always well-oiled.
SeaORM 1.1.12 is out and with it expect exciting goodies like enhanced enum support and Postgres IpNetwork integration, proving that even stable releases can get a delightful glow-up.
The Rustacean Station podcast interviewed DongYoon Kang (creator of SWC) discussing the creation and background of SWC, its adoption by major platforms like Deno and Next.js, his experience learning Rust to build it, and future plans including Dart support. [audio]
The amazing folks at Cognitive Engineering Lab published the "C++ to Rust Phrasebook" to assist C++ developers in transitioning to Rust smoothly.
Orhun Parmaksız (
RatatouilleRatatui Captain) released git-cliff v2.9.0 and he is hosting a "Rat in the Wild Challenge" urging you to create the most outlandish and unexpected applications using Ratatui library, get involved for a chance to win a Ratatui apron.Sven Kanoldt's article, "Designing Error Types in Rust Libraries," discusses best practices for creating robust and maintainable error handling in Rust libraries, contrasting approaches like using thiserror with boxing or custom wrapper types to avoid leaking internal dependencies, and referencing std::io::Error as a prime example.
Nathan Flurry (Co-founder and CTO of Rivet), wrote a blog post highlighting a 2,000x improvement in route propagation speed achieved by rewriting the Traefik gateway in Rust.
Alec Mocatta, the founder of Tably, hilariously recounts his “10 years of betting on Rust and what I’m looking forward to next”. He's now eagerly looking forward to another ten years of Rust magic, including faster builds and even friendlier compiler features.
Federico Blancato wrote on “Self-referential structs in Rust”, highlighting the challenges of implementing self-referential structs in Rust, where one field borrows from another within the same struct. He then presents two safe solutions: using memory arenas (like bumpalo) or the ouroboros crate.
Microsoft open-sourced injectorpp, a crate that lets you easily change function behavior at runtime for unit testing, eliminating the need for extra traits or code refactoring. Say goodbye to messy test-specific code.
Bonus
11. If you're in or around New York, the Rust NYC meetup will be happening tomorrow, at Pensar, beginning at 6:30 PM. Come join us to talk and chat about Rust.
Thank You ☕
One of you bought us coffee and we’re incredibly grateful for it.
If you're reading this and you're the one, know that your support means the world to us. ♥️
And if you're feeling generous, you can treat us to a coffee as well.
CodeCrafters: Become a Better Rust Engineer
CodeCrafters created amazing Rust courses that push your skills beyond the basics.
You’ll have fun building real-world projects from scratch, including Git, Docker, Redis, Kafka, SQLite, Grep, BitTorrent, HTTP Server, an Interpreter, and DNS.
The courses are self-paced, so you can learn at your own speed.
If you’re itching to level up your Rust skills, these courses are perfect for you.
Here’s what makes CodeCrafters stand out:
Learn by building projects that challenge you beyond just implementing CRUD features.
Strengthen your fundamentals by working on awesome low-level projects.
Get really good at reading and writing idiomatic Rust code.
Plus, take part in monthly contests for a chance to win exciting prizes.
You can get your CodeCrafters fees fully reimbursed through your corporate Learning & Development (L&D) budget.
Be sure to check with your employer about tapping into your L&D budget to save money and make this a no-brainer opportunity to level up your skills.
Get 40% off when you sign up here. [affiliate]
SUPPORT RUST BYTES
You’re Rust Bytes biggest fans, and we love to see it.
Here’s how you can help spread the word:
❤️ Recommend Rust Bytes to your friends.
🤳 Connect with us on our socials: X, BlueSky, Mastodon, Publication.
☕️ Support our editors by buying us coffee.
📨 Email us at rustaceanseditors@gmail.com for sponsorship, feedback or ideas.
Take care of your body and drink some water.
That's all for now, Rustaceans.
John & Elley.