This was super helpful! Whilst I've always understood the lifetimes concept but I've always struggled to grok the lifetime syntax. This was a massive help in understanding it, thank you!
15:54 The generic form implies, that item 1 and item2 are of exactly the same type, while the function on line 36 can have arguments of two different types, as long as they implement Summary. Notify needs a second generic.
This was really good. It covers things I feel I already know, but each time it is covered, it is like learning it again. It solidifies the knowledge. I guess I never really knew the Elision rules so was always a bit confused about when I need to specify explicit lifetimes. The quote "lifetimes are very much a tool to get rid of dangling pointers" really stuck with me. I felt like I knew that but I guess not that well, but it is now in the forefront of my mind.
For those who haven't figured when to employ monomorphism or polymorphism yet, if you ever feel like the binary size might go crazy big due to monomorphization and you want to keep it small, use the Dyn keyword, and sacrifice some runtime performance so you can get smaller binary. How can you know when it might go crazy big? (Might be wrong, but I shouldn't be far) if your function has 1 Generics, the max amount of variants for that specific function is X^1, where X is the all the types that you used the generic function with. For example, you use the generic function with f64 and i64, you will get 2 variants. if you use a Function with 4 generics, the max amount of variants that might be generated is X^4. So if you ever feel constrained by binary size, fixing monomorphization on generics might be a place you want to look to fix.
Hey Riki! (Ricki, Ricky, …?) Awesome videos. You explain things in a very clear and engaging way. I look forward to watching more of your Rust videos. I have a small suggestion- when pasting something (e.g., the generic version at time: 2:57), I think it may be helpful to not delete the nongeneric code in the process, so that generic and nongeneric can be compared side-by-side. Thanks for making these, they’re great! - Joey
Fantastic man, Really enjoying the playlist, can see the difference how experiences programmers talk about and explain the concepts of rust !! really looking for the next !! Could you do a dedicated video on static generic lifetimes !!
Excellent video, my friend. Very informative. The google algorithm brought me here. You just got a new subscriber. Looking forward to more content like this.
Something about the shape of the U!? No, man, it's just the next letter in the alphabet after T. 😅 (Similarly, S is common because it's the letter before T.) Admitted, the similarity of U and V might be a reason why R, S, T could be preferred over T, U, V if you need more types; though for very many single-letter types it can also make sense to start with A, B, C, to have more room in the alphabet, or use T1, T2, T3, if you like numbers.
Great job! You probably have already covered this somewhere else but I really like the extension in your VS Code that highlights the brackets location. Can you share the name? Thank you!😊
How would you ever create an application in a non-object-oriented programming language? It seems impossible. You need those handy classes, methods, properties and encapsulations...
Ah it's c++ templates again... for when void* isn't good enough. Except, it's not a void pointer in the way it functions... this is function overloading.
Quite a bit of detail is missing. The video does go into some detail, but a bit shallow. I would have expected to see unit tests and implementations that are complete. Please keep it going, but add some more additional context. Thank you!
It’s people like you that will increase rust adoption. Thank you for this style of explanation. Very concise and clear with examples.
Very helpful. It's hard to find detailed videos on Rust by experienced engineers in it.
Look up Jon Gjengset
not a video, but you can also find the explanation in the rust book. :)
This was super helpful! Whilst I've always understood the lifetimes concept but I've always struggled to grok the lifetime syntax.
This was a massive help in understanding it, thank you!
This is the best and detailed tutorial about Generics, Traits and Lifetimes that I've found, thank you!
15:54 The generic form implies, that item 1 and item2 are of exactly the same type, while the function on line 36 can have arguments of two different types, as long as they implement Summary. Notify needs a second generic.
This was really good. It covers things I feel I already know, but each time it is covered, it is like learning it again. It solidifies the knowledge. I guess I never really knew the Elision rules so was always a bit confused about when I need to specify explicit lifetimes.
The quote "lifetimes are very much a tool to get rid of dangling pointers" really stuck with me. I felt like I knew that but I guess not that well, but it is now in the forefront of my mind.
For those who haven't figured when to employ monomorphism or polymorphism yet, if you ever feel like the binary size might go crazy big due to monomorphization and you want to keep it small, use the Dyn keyword, and sacrifice some runtime performance so you can get smaller binary.
How can you know when it might go crazy big? (Might be wrong, but I shouldn't be far)
if your function has 1 Generics, the max amount of variants for that specific function is X^1, where X is the all the types that you used the generic function with. For example, you use the generic function with f64 and i64, you will get 2 variants.
if you use a Function with 4 generics, the max amount of variants that might be generated is X^4.
So if you ever feel constrained by binary size, fixing monomorphization on generics might be a place you want to look to fix.
Thank you so much for including the specific chapter in the rust handbook!
Hey Riki! (Ricki, Ricky, …?) Awesome videos. You explain things in a very clear and engaging way. I look forward to watching more of your Rust videos. I have a small suggestion- when pasting something (e.g., the generic version at time: 2:57), I think it may be helpful to not delete the nongeneric code in the process, so that generic and nongeneric can be compared side-by-side. Thanks for making these, they’re great!
- Joey
keep posting videos. I really like them!!
*THIS VIDEO IS SPECTACULAR AND EVERYONE SHOULD WATCH IT*
you are great annunciator. very clearly explained and easy on the ears
thank you this was very helpful with detail explanation pls never stop making more
Awesome video. You teach very well, and this really made generics "click" with me. Thanks.
I believe I was your 1,000th subscriber too!
Fantastic man, Really enjoying the playlist, can see the difference how experiences programmers talk about and explain the concepts of rust !! really looking for the next !!
Could you do a dedicated video on static generic lifetimes !!
Wow this is perfect explanation for me, except Lifetimes explanation seems was for advanced Rustlers, thanks a lot
Thank you! You explain everything well!
Thank you for this video, learned a lot and opened my mind to more possibilities for coding solutions :)
Excellent video, my friend. Very informative.
The google algorithm brought me here.
You just got a new subscriber.
Looking forward to more content like this.
Thanks a bunch, great video!
Thank you for the video. You got a new sub!
Which extension are you using to see scopes with the yellow line?
Thank you
Something about the shape of the U!? No, man, it's just the next letter in the alphabet after T. 😅
(Similarly, S is common because it's the letter before T.)
Admitted, the similarity of U and V might be a reason why R, S, T could be preferred over T, U, V if you need more types; though for very many single-letter types it can also make sense to start with A, B, C, to have more room in the alphabet, or use T1, T2, T3, if you like numbers.
It was a wonderful video I totally get the concept of generics and trait, however some part of the lifetimes are still not clear to me.
Great job! You probably have already covered this somewhere else but I really like the extension in your VS Code that highlights the brackets location. Can you share the name? Thank you!😊
In case you're still looking. It's built into VS Code itself. Look for bracket pair guides in the editor config.
@@necromeo-dev thx, was looking for that, right in the moment
Mind-bending, but useful!
ayt, this is very nice and brief explanation
Cool stuff! Thanks
Thank you. what is the solution for `longest` in 26:05 (returning a dropd value), I encounter this problem and couldn't find the best solution.
U is also the next letter in the alphabet after T
How would you ever create an application in a non-object-oriented programming language? It seems impossible. You need those handy classes, methods, properties and encapsulations...
trying to fix 5:11 but it gives out more and more errors. would've been nice to see the stuff running before you moved on to the next thing
ua-cam.com/video/JLfEiJhpTbE/v-deo.html
This is lifted straight from the Rust book unfortunately. I was looking for a different take to reinforce my learning.
every top rust video is its ridiculous
Which colorscheme you use?
I switch off between a couple. I use GitHub Dark High Contrast but this video might be GitHub Dark without the High Contrast.
What is the name of the fonttype you are using in this video?
I love using Blex Mono Nerd Font. It's a patched version of Plex Mono by IBM's Carbon deign
T stands for c++ Template, haha. The first example is one step away from a linear sort.
Good
Ah it's c++ templates again... for when void* isn't good enough. Except, it's not a void pointer in the way it functions... this is function overloading.
Love it
I'll do what I want to do.
its like template at c++ i see
Please, don’t add background music to teaching videos. It’s distracting.
Right, do not duplicate your code! Better create a macro that duplicates it for you 😂
Quite a bit of detail is missing. The video does go into some detail, but a bit shallow. I would have expected to see unit tests and implementations that are complete. Please keep it going, but add some more additional context. Thank you!
Thank you for the feedback.
Did you just copy the code examples 1:1 from Let's Get Rusty?
The examples are from the Rust Programming Book. The link is in the description if you would like to take a look and follow along.
@@TheDevMethod Sorry for the misunderstanding. I watched 2 vids after another and saw the same code examples
"Borrowed" is an utterly confusing stupid term - wouldnt a simple "out of scope" be much better