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.

Borrowing and References: Rust’s Version of ref (But Nicer)

Borrowing and References: Rust’s Version of ref (But Nicer)

If you’ve been writing C# for a while, you’ve likely crossed paths with ref, in, and out parameters. They allow you to pass variables by reference, enabling a method to read or modify the original value.

Useful? Definitely.

Safe? Uh… sometimes.

In Rust, there’s a similar concept called borrowing. It uses & and &mut, and it feels a lot like passing ref or in in C#, but with one significant difference:

The compiler enforces safety rules that make data races and invalid access impossible.

Today, we’re diving into borrowing, references, and how Rust holds your hand (and your memory) without letting you write foot-gun code.

Move Semantics in Rust: What Just Happened to My Variable?

Move Semantics in Rust: What Just Happened to My Variable?

Okay, so picture this: you’re cruising along in your nice, type-safe Rust code, and suddenly… your variable vanishes.

Not literally, of course. But the compiler throws a fit, and you’re left staring at an error that says something like:
“value borrowed here after move”.

Wait, move?

Welcome to move semantics, Rust’s very opinionated way of managing memory and keeping you from accidentally using things that don’t belong to you anymore.

Today’s post is a follow-up to yesterday’s crash course in ownership and this one might sting a little at first if you’re coming from the comfy world of .NET’s reference types. But stick with me. It’s about to make sense.

Ownership, Borrowing, and the Compiler’s Wisdom

Ownership in Rust: The Most C++-ish Thing I’ve Loved (and I Mean That in a Good Way)

Let’s get one thing out of the way: as a C# developer, I’ve never had to think too hard about memory. The garbage collector (GC) is always there, lurking in the background, sweeping up after my code, like a very polite, very invisible butler.

But Rust? Rust doesn’t do garbage collection. There’s no GC.Collect(), no memory profiler needed to chase leaks from forgotten Dispose() calls. Instead, Rust gives you something bold, powerful, and… at first, kind of intimidating:

Ownership.

Today’s post kicks off Week 2 of my Rust adventure, and it’s all about how this one idea changes everything.

Reflections on Week 1: Rust's Minimalism Hits Different

Reflections on Week 1: Rust’s Minimalism Hits Different

Seven days into learning Rust, and I feel like I’ve been through a developer bootcamp with a compiler that doubles as a personal trainer. It doesn’t let you slack, but it does make you better.

This week, I went from installing the toolchain to wrestling with immutable variables and puzzling over semicolons in return statements. As a C# developer, I expected syntax differences, but I didn’t expect the philosophical shifts.

Let’s recap what stood out, what stung, and why I’m still excited to keep going.

Rust Scalar and Compound Types: Where Are My C# Classes?

Rust Scalar and Compound Types: Where Are My C# Classes?

When I first started exploring Rust, one of my instincts was to reach for a class. You know the drill. Need to model some data? Write a class, slap a few properties on it, and maybe add a constructor or two.

But Rust had other plans.

On Day 6, I dug into Rust’s scalar and compound types and quickly realized that Rust doesn’t want you to start with classes. Instead, it hands you a small set of powerful primitives and says, “Let’s build something lean.”

Functions in Rust: Familiar Yet Different

Functions in Rust: Familiar Yet Different

Today’s Rust lesson hit a familiar note but with a twist. Writing functions in Rust feels almost like writing them in C#. Until, of course, the compiler reminds you that this language doesn’t always play by the same rules.

On Day 5 of my Rust-for-C# developers journey, let’s break down function definitions, type inference, return values, and where Rust and C# shake hands… and where they give each other a suspicious side-eye.
On Day 5 of my Rust-for-C# developers journey, let’s break down function definitions, type inference, return values, and where Rust and C# shake hands… and where they give each other a suspicious side-eye.