16:05 A correction: Only the crate that defines a type can add inherent methods to it (it is merely that you are allowed to do it in any *module* of that crate). If you want to add methods to a type in some library you depend on (or to e.g. a primitive type like i32), then you have to put them on a trait and implement it for those types (and then code that wants to use those methods must import the trait). This pattern is known as writing an "extension trait."
Learning rust after learning other programming languages absolutely boggles mind 🤯. But in these videos its features have been explained to very basic level, comparing them with other language's features make the videos much easier to learn. Thanks Doug.
I think I've heard the ampersand mentioned in relation to dereferencing, coercion, and borrowing. Looking forward to understanding it better. These videos are fantastic. I really appreciate them.
I have just discovered your channel with this video, and found it very useful. The content is excellent, but what struck me are two things about the production: no background music - I'm hearing impaired so clarity is extra important to me; and the pacing is great, particularly because you don't edit out pauses, allowing me to follow along without having to continually pause and step back (as much). I look forward to watching more of your videos.
23:05 You can derive the Default trait like this as well. When you don't care about what values struct members take so long as they are valid, this can be a faster option. It'll work as long as all the member types have a implementation for Default, which is true for all primitive types and a lot of other standard types. Just adding this since I looked up Default trait in the Docs and others might also be curious.
I was learning Rust after knowing C++ and for the first week I hated compiler because it's constant errors reporting and refusing to compile code. It's like grammar teacher but worse. It will fail your test after just one mistake. Now after 1 month I can't imagine life without Rust compiler. It's called Stocholm Syndrome? :D Great tutorial Doug, best I saw on TH-cam.
Yeah, it's funny... at first you hate it, and then you love it. I think that's often the case when you're learning something very new and you have to break your assumptions. Well worth it, though!
Thank you sooooo much, very good didactics, clear, concise, a warm friendly voice, I love you, as a BRO :-) :-), please more, sugestion if you like, Rust and Vulcan API, 1000 Thanks
I'm glad you like them! I'll take your suggestion into serious consideration. I probably wouldn't be able to get to it for a while because I have a lot of other topics I want to get to first. And, that pesky thing called life keeps getting in the way :) But I'll definitely put it on my list. If more people ask for it, I'll prioritize it.
Thanks, no hurry, oooonly! an idea ;-). The reason was, Vulkan (with Vulkano Wrapper for Rust) is OS agnostic, runs everywhere, Rust runs everywhere, Rust tools Visual Studio Code runs everywhere, so for high performance applications on all plattforms I think this is perhaps a good idea. So this was ooooonly a little small tiny suggestion ;-) Best wishes from Berlin
I agree that it's an important topic. I'm all about cross-platform, hence one of the reasons I love Rust so much. There's a new API standard called WebGPU if you haven't heard of it, and there are some Rust crates actively working on that. I'm super excited! It will be a major leap forward with native/web graphics efficiency, but also cross-platform capabilities. But, it also increases complexities... always a trade-off, right? In any case, I'm salivating for when all platforms can have the same efficient, powerful API implementation.
@@chrisjudge705 webgl is the API standard based on opengl ES with some modifications (maybe), implemented by and available in most browsers only. WebGPU is a newer graphics API standard equivalent to opengl or directx and it will be based on vulcan. moreover it wont just be implemented by browsers, but also as SDK extensions for native platforms. So webGPU api will be available as a cross platform vulcan replacemnt(-ish) for native applications also, which you wanted Mr. Milford to cover in his lessons. This is better because the same code will also run in browsers if you switch rust's compile target to wasm
Thanks Doug for the excellent training on Rust. When will you have your Generics video ready ? Also, I would love to see more of your fantastic video's in Rust and in particular more intermediary and advanced projects and topics in Rust. Doug is the Best of the Best !
i have been binging your videos doug and commenting everywhere on your channel.. but seriously thank you so much for these... i wish i could send you a gift or a coffee for all your work... you remind me of two other video teachers I have had in my life: Jeffrey Way and John Lindquist. Some of the best teachers on the planet and noone came close to them so far until now.. You are on the same pedestal for me.
Just a small detail: The definition order of fields in structs is not completely irrelevant. If you derive Ord or PartialOrd, the order of the objects will be based on the order of each field, with the fields defined first taking precedence over the ones defined after.
Can RUST organize structs internally differently than declared? For example, might it reorganize the above to f64, i32, bool to maximize native alignment? Or does it default to padding out the field bool (followed by three bytes), followed by i32, and f64. For those needing precise positioning of fields I believe the #[repr(C)], #[repr(packed(n))], #[repr(C, align(n))] can be used.
Referring to alphabetical order of struct vars. Shouldn’t they be declared from the biggest to the smallest to reduce padding/alignment? Or rust’s compiler is smarter than C++’s in this case?
Great series! I know it was just to show why consistency matters but i was surprised to see you put a double between a boolean and a int32. Does rust have different allignment rules than c++?
I abstract functions and computed properties in swift for ios just like rust in what is called an extension. Also traits are basically protocols in swift. So learning rust is becoming kinda easy but those damn lifetimes are driving me nuts! I have seen you can declare a lifetime wit a '_ vs lets say 'a.
composition is great, but it is bad to enforce it and give no other choice... smart programmers know when to use what it would be weird to define a Duck as something that has Animal )
This person is awesome.
16:05 A correction: Only the crate that defines a type can add inherent methods to it (it is merely that you are allowed to do it in any *module* of that crate). If you want to add methods to a type in some library you depend on (or to e.g. a primitive type like i32), then you have to put them on a trait and implement it for those types (and then code that wants to use those methods must import the trait). This pattern is known as writing an "extension trait."
9:10 "It's easy to get used to - _the water is warm_ "
I might steal this
Learning rust after learning other programming languages absolutely boggles mind 🤯. But in these videos its features have been explained to very basic level, comparing them with other language's features make the videos much easier to learn. Thanks Doug.
You can use alt-up-arrow/alt-down-arrow in VS Code to move lines up or down to make your field-sorting even more efficient.
woah, thanks!
I think I've heard the ampersand mentioned in relation to dereferencing, coercion, and borrowing. Looking forward to understanding it better. These videos are fantastic. I really appreciate them.
I have just discovered your channel with this video, and found it very useful. The content is excellent, but what struck me are two things about the production: no background music - I'm hearing impaired so clarity is extra important to me; and the pacing is great, particularly because you don't edit out pauses, allowing me to follow along without having to continually pause and step back (as much). I look forward to watching more of your videos.
I like this style of teaching.
23:05 You can derive the Default trait like this as well. When you don't care about what values struct members take so long as they are valid, this can be a faster option. It'll work as long as all the member types have a implementation for Default, which is true for all primitive types and a lot of other standard types. Just adding this since I looked up Default trait in the Docs and others might also be curious.
Yeah, good tip! Thanks :)
I am so happy to be able to have such high quality explanation for free. Thank you, from a new CS student from Poland!
I was learning Rust after knowing C++ and for the first week I hated compiler because it's constant errors reporting and refusing to compile code. It's like grammar teacher but worse. It will fail your test after just one mistake. Now after 1 month I can't imagine life without Rust compiler. It's called Stocholm Syndrome? :D
Great tutorial Doug, best I saw on TH-cam.
Yeah, it's funny... at first you hate it, and then you love it. I think that's often the case when you're learning something very new and you have to break your assumptions. Well worth it, though!
Thank you sooooo much, very good didactics, clear, concise, a warm friendly voice, I love you, as a BRO :-) :-), please more, sugestion if you like, Rust and Vulcan API, 1000 Thanks
I'm glad you like them! I'll take your suggestion into serious consideration. I probably wouldn't be able to get to it for a while because I have a lot of other topics I want to get to first. And, that pesky thing called life keeps getting in the way :) But I'll definitely put it on my list. If more people ask for it, I'll prioritize it.
Thanks, no hurry, oooonly! an idea ;-).
The reason was, Vulkan (with Vulkano Wrapper for Rust) is OS agnostic, runs everywhere, Rust runs everywhere, Rust tools Visual Studio Code runs everywhere, so for high performance applications on all plattforms I think this is perhaps a good idea.
So this was ooooonly a little small tiny suggestion ;-)
Best wishes from Berlin
I agree that it's an important topic. I'm all about cross-platform, hence one of the reasons I love Rust so much. There's a new API standard called WebGPU if you haven't heard of it, and there are some Rust crates actively working on that. I'm super excited! It will be a major leap forward with native/web graphics efficiency, but also cross-platform capabilities. But, it also increases complexities... always a trade-off, right? In any case, I'm salivating for when all platforms can have the same efficient, powerful API implementation.
Thanks for the hint, I have not recognized the difference WebGL and WebGPU
@@chrisjudge705 webgl is the API standard based on opengl ES with some modifications (maybe), implemented by and available in most browsers only. WebGPU is a newer graphics API standard equivalent to opengl or directx and it will be based on vulcan. moreover it wont just be implemented by browsers, but also as SDK extensions for native platforms. So webGPU api will be available as a cross platform vulcan replacemnt(-ish) for native applications also, which you wanted Mr. Milford to cover in his lessons. This is better because the same code will also run in browsers if you switch rust's compile target to wasm
Thanks Doug for the excellent training on Rust. When will you have your Generics video ready ? Also, I would love to see more of your fantastic video's in Rust and in particular more intermediary and advanced projects and topics in Rust. Doug is the Best of the Best !
i have been binging your videos doug and commenting everywhere on your channel.. but seriously thank you so much for these... i wish i could send you a gift or a coffee for all your work... you remind me of two other video teachers I have had in my life: Jeffrey Way and John Lindquist. Some of the best teachers on the planet and noone came close to them so far until now.. You are on the same pedestal for me.
Pure gold for beginners, thank you so much!
4:25 Yeah you are right, "Everything is KEREN..."
Just a small detail: The definition order of fields in structs is not completely irrelevant. If you derive Ord or PartialOrd, the order of the objects will be based on the order of each field, with the fields defined first taking precedence over the ones defined after.
Impressed with the quality of your tutorial, subscribed and can only hope you can keep making more videos!
Oh, thanks! Yeah, I'm working on a new video as we speak and I have whole a ton of topics I want to get to.
This is amazing! I love your way of talking. Fun, concise and simple.
Great video, a ton of information perfectly packed without being too overwhelming
Your tutorials making a tough language easy to learn
rust book is quite good but there are some concepts that I am not able to grasp but bow I can cuz of your tutorials
~THANKS!
Doug, you rock. I think your videos are super helpful! Definitely deserve more subs!
Hands-down best Rust series on TH-cam
I like this guy✌️
Loving your videos ! Very helpful for absolute beginners with Rust.
Can RUST organize structs internally differently than declared? For example, might it reorganize the above to f64, i32, bool to maximize native alignment? Or does it default to padding out the field bool (followed by three bytes), followed by i32, and f64. For those needing precise positioning of fields I believe the #[repr(C)], #[repr(packed(n))], #[repr(C, align(n))] can be used.
As a Web-developer the `loosey goosey JavaScript` thing really hurts😂. Well Typescript mitigates many of those pains👍
Best rust tutorial ever
Thank you Doug, this was very usefull. A friendly, easy to understand tutorial.
enjoy with your teaching style
Thank you! 😃
Found some great advice in this video managing code.
The water is warm .. is the 10th time I see this video since 2019
This is too fast for a person coming from OOPS world, but I'll keep replaying it! really nice stuff!
Thank you! Thank you! Thank you! Your tutorials are excellent!
Great videos, very helpful
wow thanks for this!
Referring to alphabetical order of struct vars. Shouldn’t they be declared from the biggest to the smallest to reduce padding/alignment? Or rust’s compiler is smarter than C++’s in this case?
Great series! I know it was just to show why consistency matters but i was surprised to see you put a double between a boolean and a int32. Does rust have different allignment rules than c++?
I abstract functions and computed properties in swift for ios just like rust in what is called an extension. Also traits are basically protocols in swift. So learning rust is becoming kinda easy but those damn lifetimes are driving me nuts! I have seen you can declare a lifetime wit a '_ vs lets say 'a.
you're a good tutorial person :)
your Rust videos are so good!
There will be a DougStruct in all my Rust code; forever.
best I have seen yet
I believe you can also do Default::default()
"Structs traits and impl-mentations"
😅 nice one
Doug you are awesome
Maybe i will just stick to Python, this is difficult
Totally got a sub from me. This man cracked me up so much! Amazing content too!
Thanks!
Yep yep :)
good job
Ah, thanks!
4:23 everything is Keren.
Thanks
4:32 KEREN, hahahahahaha
The waters warm........... Who pee-ed?
The waters warm?
Ha, ha, ha... didn't like that one, huh? Eh, they all can't be winners.
"Water is warm" 😂😂
ayyyy
😂,angry sound is funny
This is like C but save.
16:05, this will lead to a complete mess in large projects...
composition is great, but it is bad to enforce it and give no other choice... smart programmers know when to use what
it would be weird to define a Duck as something that has Animal )
IMO, "#[allow(unused_variables)] //This is so I don't get warnings throughout the demo" is slightly more intrusive than yellow squiggles. :)
Fair enough :)
I like it.. i hate those warnings