Did another video about marker traits get made. I still don't understand how they work. Effectively they're empty traits so I just don't understand how they're useful when used (for example) as trait bounds?
Just got the cheat sheet. Very nice! I might suggest adding .or_insert_with to the HashMap functions, because you can use it to insert a value returned from a closure without running the closure if the map already has the key. (Apparently parameter expressions are evaluated before functions are called, unless the parameter type is constrained to FnOnce by the function signature.)
At 4:02 you suggested that the main reason to choose associated types over generics (in specific situations) was because you may want a concrete type, but don't generics specify the concrete type as well, the one passed into the impl Iterator< *T* >? I'm still not understanding why I would ever choose to limit how others may use my traits to only one implementation per struct.
At 5:44 you have a great example from standard library: you have a generic for the right member, because a type can be added by many other types. However adding two given types always return the same type, so the output is an associated type
I keep coming back to to these videos, mainly because i don't understand shit in the first time, then as I learn more by practice, I come back and see that I understand a little bit more and more. Wish these were also beginner friendly. I still get confused and zone out a lot on this 😂
I don't know about any libraries, but there is another thing. In std Rust containers you can't specify the way it sorts or compare its elements (e.g. BTreeSet or HashMap) by providing some functor to do it (this is C++ way). Std containers only uses impls of contained type (BTreeSet requires Ord trait). So, for example, there is a struct Student, that has average score and age. How you can say if one student is "less" than other? Well, in general case you can't make an Ord trait impl. But in specific case you can use neotype pattern to wrap your student and impl Ord trait for it, using e.g. age as a main parameter. So even std library is pushing us to use this pattern)
Hi Can you share what are all the extensions that you are using for VScode I see you have Run|Debug on your main and also Implementations on your tratis. Also I see VSCode is helping you code autocompletion when you are implementing rust. I will be a great help if you can share those extensions Thank you!
So you started the video by telling us to subscribe, before we (newcomers) have even seen evidence of why we should. This is even more annoying than the customary "like, comment, and subscribe" found at the end (which you ALSO had). On the other hand, it was impressive how I'd ask a question at my screen and you several times answered it almost immediately. So, maybe I'll upvote the NEXT video of yours that I watch. Assuming it doesn't do the subscription-solicitation-at-the-beginning thing again, at least.
📝 Get your *FREE Rust cheat sheet* : www.letsgetrusty.com/cheatsheet
This is probably the most comprehensive tutorial for Rust. Like the way how precisely you explain things.
I don't know if they are considered advanced, but you could've talked about auto traits, the !traits and the Sync and Send.
auto, negative (!), and optional (?) trait would be good advanced topics to cover IMO. Sync and Send probably fits better in multithreading videos.
@@scheimong that's true.
Will have to make another video about that :)
@@scheimong
The only optional "?" Trait in rust is "Sized" .
Did another video about marker traits get made. I still don't understand how they work. Effectively they're empty traits so I just don't understand how they're useful when used (for example) as trait bounds?
Just got the cheat sheet. Very nice! I might suggest adding .or_insert_with to the HashMap functions, because you can use it to insert a value returned from a closure without running the closure if the map already has the key. (Apparently parameter expressions are evaluated before functions are called, unless the parameter type is constrained to FnOnce by the function signature.)
🦀🦀🦀🦀🦀 Rust forever 🔥🔥🔥🔥🔥🔥🔥
At 4:02 you suggested that the main reason to choose associated types over generics (in specific situations) was because you may want a concrete type, but don't generics specify the concrete type as well, the one passed into the impl Iterator< *T* >? I'm still not understanding why I would ever choose to limit how others may use my traits to only one implementation per struct.
At 5:44 you have a great example from standard library: you have a generic for the right member, because a type can be added by many other types. However adding two given types always return the same type, so the output is an associated type
I really like your videos. Already rust is my second lang, thanks :)
Rust is my my 6th lang
6:00 Correction: the RHS is the type for the second operant of the sum, not the return type.
I finally understood the difference with Generics and Associated Types, thanks!
I keep coming back to to these videos, mainly because i don't understand shit in the first time, then as I learn more by practice, I come back and see that I understand a little bit more and more. Wish these were also beginner friendly. I still get confused and zone out a lot on this 😂
Same here, but I see progress so I keep going
imagine not being subscribed. let’s get rusty breh.
Hey man, I'm really enjoying your videos, they are a great learning resource!
Nice series !
I was about to say , then you could use traits for operator overloading , then 10 secs later , you go into operator overloading ... lol cool
I definitely didn't know about the last one. I wonder if some libraries actually use that kind of pattern, so far I haven't seen it.
I don't know about any libraries, but there is another thing. In std Rust containers you can't specify the way it sorts or compare its elements (e.g. BTreeSet or HashMap) by providing some functor to do it (this is C++ way). Std containers only uses impls of contained type (BTreeSet requires Ord trait).
So, for example, there is a struct Student, that has average score and age. How you can say if one student is "less" than other? Well, in general case you can't make an Ord trait impl. But in specific case you can use neotype pattern to wrap your student and impl Ord trait for it, using e.g. age as a main parameter.
So even std library is pushing us to use this pattern)
@@arjentix interesting
Can you please make a tutorial about tui-rs that would be really cool after the book of course
beautiful English, Bogdan. Приємно чути!
I love the highlights your VSCode extension is adding to the "derive" macro, what's the extension you're using called?
Rust analyzer
i really like the code examples... *waving arms furiosly*!
I like the series, thanks. Maybe slightly a little fast, constructive feedback 😉
Sometimes, generic make you write dumb things like
::into(mystruct)
If the compiler can’t decide what you’re trying to turn MyStruct into
It be that way sometimes
in ur first example what would counter.next() return?
Good explaination. Thanks!
Nice channel mate, subbed
Very good.... Continue.
Rusty videos as always! :)
great channel!
i see that rust very fast compiling on your pc, could you share your hardware specs?
Hi
Can you share what are all the extensions that you are using for VScode
I see you have Run|Debug on your main and also Implementations on your tratis.
Also I see VSCode is helping you code autocompletion when you are implementing rust.
I will be a great help if you can share those extensions
Thank you!
I use rust-analyzer. A video going over my entire setup is on the way!
At 10:07, why doesn't Rust make it possible to do something like Human::::fly()? Or even with the instance as human::::fly()?
Based Bogdan :) Thx for this video
Based Bogdan.... I like it.
Please make a series on Actix also
how about some testing and moqing
штракт, штринг
exactly, my ears are literally bleeding when I hear shtruct, shtring.
in german schtruct, schtring :)
Let's be honest, that human is never gonna fly without a proper Naruto-run in advance.
need some help with surrealdb
I love you. Sorry that's only for Mrs Moore!
I love you too
Can you talk about std::any?
So you started the video by telling us to subscribe, before we (newcomers) have even seen evidence of why we should. This is even more annoying than the customary "like, comment, and subscribe" found at the end (which you ALSO had). On the other hand, it was impressive how I'd ask a question at my screen and you several times answered it almost immediately. So, maybe I'll upvote the NEXT video of yours that I watch. Assuming it doesn't do the subscription-solicitation-at-the-beginning thing again, at least.
Sounding kinda soft my dude
Softest in the game