Building a Podcast Player to Learn Rust (Part 1)
This post is part of a series. View the next one here.
A couple months back, I learned of the Rust programming language. I was watching a YouTube video of an engineer praising Rust for its safety and performance. They compared it to C++, which I've always been afraid of. But then they said something which gave me hope.
The YouTuber said that Rust streamlines the most frustrating part of writing low-level code: memory allocation. I looked it up, and... yep, that looks miserable. I would much rather learn to use the borrow checker than jump straight into manually allocating and freeing memory for every variable.
As someone who works with Typescript/React/Express by day, I depend on a lot of abstractions to get my work done quickly. I'm grateful that I can get my job done without worrying too much about the concepts my programming predecessors toiled to hide from me behind neat APIs.
But whether it's out of curiosity or some sense of obligation to those who traveled these tangled interwebs before me, I need to know what's going on at a deeper level. I'm the type who just has to know.
So I decided Rust would be my gateway to low-level programming. It seems it would be a good way to learn more about fundamental concepts without having to wrestle as much with the boilerplate of the longer-lived languages.
The only issue was deciding what project to code. I wanted to do something that meets these criteria:
- I would personally use the application
- The application requires the use of system-level APIs
- The application requires the use of networking
- The application has a GUI
The first thing I could think of that meets these criteria was a podcast player.
At this point, I have implemented the following:
- Add feeds to a persisted list (stored as JSON)
- Fetch the XML file from the specified URIs in the JSON file
There is clearly a long way to go, but just to implement this I have had to learn:
- Borrow checking
- Cargo build system and package manager
- Compilation targets
- File API
- Rust macro basics (to use Tokio for networking)
I look forward to learning more about low-level programming as I implement the core functionality and a GUI in the exciting world of Rust.