Ownership & Borrowing in Rust

Brandon Wofford
16 min readFeb 22, 2024

It’s become a bit of a cliché for developers by now, but I’ve fallen in love with Rust. Being self-taught, I’ve dabbled in a bunch of languages like C#, Python, JS, Go, and so on, mostly sticking to the comfort zone of garbage-collected languages. However, I’ve always been a bit jealous of the raw performance that lower-level systems languages offer, but the horror stories about all the “foot-guns” with C++ (memory leaks, dangling pointers, buffer overflows) always kept me at bay. Plus, there’s no ignoring the big security red flags — like that time in 2019 when Microsoft mentioned nearly 70% of their security issues were due to memory management, a sentiment echoed by Google’s Chrome team.

After I built a local DNS server in Go, I started thinking it might be fun to squeeze more performance out of it, and that nudged me towards finally giving a systems language a shot. That’s how I ended up diving into Rust. The syntax threw me for a loop at first, but thanks to the compiler’s guidance, I got the hang of it pretty quickly. What stood out to me was how many of the classic systems programming pitfalls just… weren’t issues. No manual memory deallocation headaches, no hunting for null pointer references, nothing. Sure, my Rust DNS server project is more of a learning experiment than anything (incomplete and barely functional), but I didn’t run into any of those notorious problems I’d been warned…

--

--