Thanks so much for your in creating understandable videos of trait and trait objects. Now to your question. I believe generic struct will be the solution.
You're welcome :) I think learning is a life long endeavor, and this is exactly the way I approach coding: I try to learn a bit every day. Sometimes that's 10 minutes, and some days I can spend 4 hours. Just always do something. As for resources: I like to mix and match. Books, Udemy courses, TH-cam, blogs. And of course you have to experiment.
This is excellent, Love the mechanical keyboard sound as you type! - Is it normal/ok to have more than 1 function in a trait ? eg Lines 2 AND 3? Most tutorials I see have just one fn inside a trait.
Glad you enjoyed the content. Yes, it is very common to have multiple functions in a trait. It is even possible for one of those functions to use the other, as we will see in an upcoming video.
So far big downside I found is that you can: fn laundry (item: &T) { item.wash(); item.dry() }. But you can not: fn laundry (item: &dyn Washable+Dryable) { item.wash(); item.dry() }. Can dynamic dispatch over two trait objects be done without workarounds like implementing dummy WashableAndDryable intermediate trait? This quickly makes code murky, because it must consist ad-hoc traits just to satisfy dynamic dispatch trait boundaries. Or am I missing something obvious here?
This has to be the best simplified explanation on dispatching on the whole internet. Love the game example too! Keep up the hard work!
Wow, this has to be one of the nicest comments I received. Thanks for taking the time to write it. I will gladly keep working on the channel :)
Excellent explanation! Much appreciated. Thank you.
Very good explanation, it helped me a lot, thanks.
Thanks so much for your in creating understandable videos of trait and trait objects. Now to your question. I believe generic struct will be the solution.
Thank you very much.
Thank you so much. Where do you guys train, how do you get to understand these things to this level.
You're welcome :)
I think learning is a life long endeavor, and this is exactly the way I approach coding: I try to learn a bit every day. Sometimes that's 10 minutes, and some days I can spend 4 hours. Just always do something.
As for resources: I like to mix and match. Books, Udemy courses, TH-cam, blogs. And of course you have to experiment.
This is excellent, Love the mechanical keyboard sound as you type! - Is it normal/ok to have more than 1 function in a trait ? eg Lines 2 AND 3?
Most tutorials I see have just one fn inside a trait.
Glad you enjoyed the content.
Yes, it is very common to have multiple functions in a trait. It is even possible for one of those functions to use the other, as we will see in an upcoming video.
So far big downside I found is that you can: fn laundry (item: &T) { item.wash(); item.dry() }. But you can not: fn laundry (item: &dyn Washable+Dryable) { item.wash(); item.dry() }. Can dynamic dispatch over two trait objects be done without workarounds like implementing dummy WashableAndDryable intermediate trait? This quickly makes code murky, because it must consist ad-hoc traits just to satisfy dynamic dispatch trait boundaries. Or am I missing something obvious here?
vscode theme name? (I bet nobody'd expect this question)
Dark rose
@@GreenTeaCoding ty