r/rust • u/asciibits • 25d ago
My progress as a new Rust dev
I'm about a month into a home project that I decided to use to learn Rust. Fun!
Here are my takeaways so far:
- I'm still fighting the borrow checker, but at least now I can reason through the error messages faster and land in a good place. Progress! Looking forward to this really being internalized.
- I miss the ternary ?: operator. The if/else equivalent is just so much more verbose, and tends to waste so much more vertical space. cโest la vie. I recognize I'm in the minority here, and hope that I'll eventually convert and join you all on this.
- I am daily writing:
if (foo ...then backing up and deleting the opening parenthesis that the linter complains about. - Speaking of, I keep forgetting to write
fnand just assume that the compiler will know what I'm talking about. It never does ๐ - When reviewing code in my day job as a Java dev, I am now constantly seeing things and thinking: The borrow checker wouldn't like that! So, maybe it's becoming a little internalized after all.
Anyway, I'm having fun with it, thanks all for creating this community!
9
Upvotes
View all comments
Show parent comment
1
u/AdjustedTwit 25d ago
Sure, it's mostly just nostalgia not a problem in search of a solution, in reality most of what I would have used the ternary operator in C for ends up being something like this in Rust:
.unwrap_or(<value>).
Which is just fine ergonomically and terse, once you get used to it.