Result: A Better Way to Fail

Result<T,E>: A Better Way to Fail

Welcome to Day 20! Today we’re talking about failure, but in the best possible way. Because, let’s be honest, things go wrong. Files go missing. Network calls timeout. Data isn’t always what we expect. And if you’ve been living in the .NET world like I have, your first instinct might be to reach for the trusty try-catch block.

Rust, though? Rust says, “Let’s not wait until runtime to deal with failure. Let’s handle it right now, at compile time.” And the tool that it gives us to do that is Result.
Rust, though? Rust says, “Let’s not wait until runtime to deal with failure. Let’s handle it right now, at compile time.” And the tool it gives us to do that is Result.

Option: Where Null Is Not an Option

Option<T>: Where Null Is Not an Option

Ah, nulls, the “billion-dollar mistake” that haunts just about every C# developer. How many times have you chased down a NullReferenceException, muttering under your breath, “But how could this even be null?” Well, guess what? In Rust, nulls are not a thing. At least, not in the wild-and-dangerous sense we’re used to in .NET.

Instead, Rust gives us Option. And let me tell you, once you get a taste of it, you’ll wonder why we ever let null run loose in the first place.

Destructuring: Pattern Matching’s Power Move

Destructuring: Pattern Matching’s Power Move

We’ve made it to Day 18, and today we’re going to unlock one of the coolest moves in Rust’s pattern matching toolkit: destructuring. If you’ve played around with C# 7+ deconstruction, you’re already familiar with the idea of “pulling things apart” for easier access. But Rust? Rust takes that idea, cranks it up, and throws in some extra muscle.

Match: Switch on Steroids

Match: Switch on Steroids

Welcome to Day 17! By now, we’ve covered some seriously cool Rust features, but today might be my favorite so far: the match expression. If you’re coming from a C# background—especially with the newer C# 8+ switch expressions—you might think you’ve seen it all. Trust me, Rust’s match is like a switch statement on steroids, protein shakes, and a Red Bull chaser.

Enums: Discriminated Unions Done Right

Enums: Discriminated Unions Done Right

Welcome to day 15! Today, we’re diving into Rust’s enums—and spoiler alert—they’re not your typical enums from C#. Rust enums are powerful, flexible, and genuinely fun. If you’ve ever looked longingly at F#’s discriminated unions (or scratched your head at C#’s enums), you’re about to discover something delightful.

Rust Structs vs C# Classes: Less is More

Rust Structs vs C# Classes: Less is More

Welcome back! After wrestling with Rust’s strict ownership rules, let’s ease into something a little more familiar (yet refreshingly different): structs. As a C# developer, you’re probably thinking, “Oh, great, Rust structs are just classes, right?” Well, not exactly. Rust structs offer a minimalist and highly efficient way to structure data, contrasting nicely with our beloved C# Plain Old CLR Objects (POCOs).

Shadowing in Rust: Redeclaring with Style

Shadowing in Rust: Redeclaring with Style

We’ve all been there. You’re coding away, and suddenly you reuse a variable name without realizing it. If you’re a C# developer, your brain probably triggers a warning alarm, screaming something like, “Hey, buddy! You’ve already used that name!” But guess what? In Rust, this isn’t just allowed—it’s encouraged, and it even has a cool name: shadowing.

So what exactly is shadowing, and why does Rust promote it? Let’s dive in and explore how this stylish redeclaration trick differs from what we’re used to in C#.

Slices and Strings: Goodbye C# StringBuilder?

Slices and Strings with Rust: Goodbye C# StringBuilder?

When you’ve spent years writing C#, you get really comfortable with string being immutable, Span being your performance trick, and StringBuilder being your go-to hammer when a for loop starts building text.

And then you start learning Rust.

Suddenly, String isn’t immutable. &str looks suspiciously like a Span in disguise. And you realize… wait, do I even need a StringBuilder anymore?

Today on Day 12, I dove into slices and strings in Rust, and let me tell you, it’s a whole new world, but a surprisingly elegant one.

The Borrow Checker: Rust’s Tough-Love Mentor

The Borrow Checker: Rust’s Tough-Love Mentor

You think you’ve been writing safe code… until you meet the Rust borrow checker.

Then suddenly, your once-proud instincts are being side-eyed by a compiler that’s not mad, just disappointed.

Today, on Day 11 of my Rust journey, we talk about the infamous, unyielding, sometimes infuriating, but ultimately brilliant guardian of Rust safety: the borrow checker.