I owe you an apology.
I said I was going to document my journey learning Rust daily…
Yeah… that didn’t happen 😅
Life happened. Work happened. Overthinking happened.
But I didn’t stop learning.
And honestly, that’s what matters.
So here we are — many days later.
Quick Recap
Last time, we:
- Installed Rust
- Built a simple guessing game
- Learned basic syntax (
let,mut,match,use)
At that point, Rust felt…
“Not that scary.”
But then I kept going.
And I finally met the thing everyone warns you about:
Ownership
The Project
Before we dive in, let me make this real.
I’m not just learning Rust for fun.
I’m building something.
A ride sharing app.
Think:
- requesting rides
- matching drivers
- tracking trips
- handling payments (eventually)
Why this?
Because it’s complex enough to force me to actually understand Rust, not just play with syntax.
So… What is Ownership?
Let me explain this in the simplest way possible.
Ownership is basically:
Who owns a piece of data in your program
And Rust is VERY strict about this.
Imagine This
You have money.
Only one person can own it at a time.
You can:
- give it away
- borrow it
- or keep it
But you can’t have two real owners at the same time.
That’s exactly how Rust treats data.
Example Time
let s1 = String::from("hello");
let s2 = s1;
Looks harmless, right?
Wrong.
After this:
-
s1is no longer valid -
s2now owns the data
If you try to use s1, Rust will stop you immediately.
Why Does Rust Do This?
Because Rust wants to prevent:
- memory leaks
- crashes
- weird bugs
Languages like JavaScript or Python hide this from you.
Rust says:
“No. You will deal with memory properly.”
At first, it feels annoying.
Then you realize:
This is actually protecting you.
The First Confusing Moment
When I saw this, I was like:
Wait… why can’t I use s1 anymore?
It felt unnecessary.
But then it clicked.
Rust is making sure:
There is only one clear owner of data at any time.
Borrowing (This Saved Me)
Instead of giving away ownership, you can borrow.
fn main() {
let s1 = String::from("hello");
let len = calculate_length(&s1);
println!("Length: {len}");
}
fn calculate_length(s: &String) -> usize {
s.len()
}
Notice this:
&s1
That & means:
“I’m borrowing this, not taking it.”
So:
-
s1is still valid - the function just uses it temporarily
Real Life Meaning
Think of it like this:
- Ownership → giving someone your car
- Borrowing → letting someone drive your car
Big difference.
Why This Matters (Especially for My Project)
Remember the ride sharing app?
We’ll have:
- users
- drivers
- trips
- locations
Data will be moving everywhere.
Without ownership rules, things could get messy:
- multiple parts of the app modifying the same data
- crashes
- inconsistent states
Rust prevents this at compile time.
Meaning:
Bugs are caught BEFORE the app runs.
That’s huge.
My Honest Experience
Ownership is:
- confusing at first
- frustrating in the beginning
- but makes sense over time
I won’t lie…
I had to re-read parts of the Rust book multiple times.
But once it clicks, you start seeing:
“Oh… this is actually clean.”
What I’ve Learned So Far
After spending more time with Rust:
- It forces discipline
- It doesn’t allow shortcuts
- It makes you think before coding
And I’m starting to understand why people say:
Rust changes how you think about programming
What’s Next
Now that ownership is (kind of) making sense…
Next up:
- borrowing deeper
- references
- lifetimes (yes… that scary word)
- and starting the ride sharing backend
Final Thoughts
I didn’t keep up with daily updates.
That’s on me.
But I didn’t quit.
And honestly, that’s the real journey.
We’re still going from:
0 → 1
Just not in a straight line.
Top comments (0)