Finally a brief/quick explanation/example for lifetimes! Apparently, I've missed the part about the generic collapsing to the shortest duration among matching arguments each time I've tried to learn. That part of the vid could be its own clip/short. Using the colored vertical lines is a great way to visualize the lifetimes. You could also add inline color to the matching variable references.
I have just wrote down these rules into anki cards after watching video from your rust playbook's course yesterday. I have repeated these cards already for like 3 times and i can say that starting learning rust through spaced repetition is greatest decision i made and i recommend this way for everybody
In the example with pushing an element to the vector you introduced a bug, when you put last element in the variable there was the last element of the vector before it was modified (not 4), but after you swap lines in the last there will be always 4. That's why when you fight with borrow checker you might introduce bugs in business logic. But in this case I believe unit tests are good option to fix that.
6:20 Moving `x.push(4);` up a line changes the behavior. Can we instead move it below the print statement? Maybe wrap the let and println statements into their own scope?
Really good teaching by example here. I feel like a lot of the time words themselves fail to illustrate concepts like this. Seeing how it works with actual code really cements it. Please keep making videos like this where you can demonstrate such concepts, thanks!
You explain stuff really well bro, thank you!!
I tried it the last couple days and I practically fell in love with the language. rustc and rust-analyzer are incredible! And the language itself is amazing once the light bulb switches on in the back of your brain. I'm pumped :D Your channel is a gem by the way! Thanks!!
Wow I can really tell the quality of your content has gone up. Bravo! Good job
Thank you for highlighting these Rust essentials in memory management as well as your clear explanation.
Tbh I got like 50% of it as I've never coded in rust. I hope this would be of great value when we start rust in our project next month
0:10 Go is extremely performant.
Explained both simply and with details. Really good work!
"general purpose, gives you low level control, is memory safe and is extremely performant" then proceeds to remove several languages that provide all of those that are not Rust. "Then there is only one obvious choice" is extremely subjective in that context. I really enjoy Rust but I also don't like to over sell it as the solution for everything. In the long run that is going to hurt the image of Rust, not help it.
While it might not have been intentional this video does a great job convincing and explaining why Rust is so fast and memory efficient. also when I started learning programming Lifetimes is how I imagined a garbage collector worked but was shocked to learn most garbage collector eat up runtime to cleanup your memory. Rust seems like a fun language to learn.
7:15 Maybe I've missed something. However, if you move the push() up one line, is this now not a different program that will print out 4 instead of 3?
The problem with Garbage Collector is not always the runtime overhead, but inconsistent freezes up to a few milliseconds when it's doing the garbage collection. A program in Go will have spikes of cpu load whereas the same program in Rust will have slightly higher median load but more spread out and predictable.
11:04 another way to phrase this is that the lifetime annotations here tell the borrow checker that a and b must live at least as long as the returned value needs to live.
I'm approaching now to Rust, and this video is making very clear some concept that are totally new for me
You need to make a course, well explained🙌🏽.
@letsgetrusty