There is a common theme with so many of these with Rust videos. The authors spend loads of time explaining the various types, but spend ZERO time explaining when to use them, how they can help in solving common patterns and the potential problems when using them. Sorry to be so blunt. Perhaps focus on the WHY rather than the HOW.
@@dispatch-indirect9206Its not as simple as stack versus heap. Yes I can allocate on the heap using Box, but then should I pass an argument to a function using a Box or a reference to a Box? What about references? When should I use a reference? I'm a seasoned C++ developer and know the difference, but newbies coming from Javascript or Python land won't have a clue when to use Box versus reference, versus stack since it's all abstracted away, but in Rust land you have make the choice. Knowing WHY is much, much harder than knowing how.
Well done. You've really explained well and You've opened my eyes to how rust really expects the user to understand how and where their data lives in memory and ensure safety. Rust seems to be a good language however that boxing, referencing and arcing is way too much effort for me. I doubt I'll be using rust any time soon unless its a truly mission critical system that requires that level of detail. I'll recommend this video to any one starting out rust.
In case of RCs it will be a circular reference. There will be A that couldn't be deleted because it references B that references A. For more details you can read "Reference Cycles Can Leak Memory" in rusts doc.
I feel rust should just have wrapper function/macros for all this stuff to cut down on trying to figure all this out. I’ve literally had to make wrappers for a lot of stuff in this video and whoever is in charge of this stuff (rust foundation) they need to abstract a lot of this stuff. I like using rust for backend development but it’s sooo rough from hours of playing with the code that i feel i’m going back to use Arc, then that’s two much because i’m not using threads so use Rc to maintain that reference but hold on wait i need to be able to borrow and mutate, so here comes RefCell. Call me a hater. Idc. It’s time to sit down and condense the language down a bit. Hopefully that microsoft money does this. Rant over.
I feel ya. After using Rust for a while the issues are few and far between, though. Remember, the Rust ecosystem is still new. No language has everything everyone wants. C++ was released in 1985 and it still receives updates. If you find functionality you feel should be more widespread, you can always make a crate :)
@@BocksdinCoding I completely understand. I was just so frustrated (while coding) vanilla rust with the usual packages for a mock project and i was just saying to myself, this could be a macro, this could be a member function, why don’t they add this or wrap this with that but your right. It’s new and i kinda feel there are three generations of rust developers. The originals that probably started with rust & actually hold jobs in the language, the middle people, who caught rust when wasn’t moved over & they had created a package to use aws with but wasn’t official and then there is this generation where i swear to you i have not seen a lifetime for the backend unless i need a custom deserializer function for some reason because i’m using a derived Arc,Rc or something along those lines. I started in the middle & im here now. Again i hope microsoft comes through & really push it over the hump. The docs have improved for practically everything too. Even if it’s a rust book or something.
@8:30 area - for the tools field, could it have been a &mut Vec instead? Update: nm, I see. The Rc needs immutable contents (thus it's fields will be too), so thus refcell. curious - I understand why Arc needs to have immutable contents, but for Rc, it's single threaded only. Do you happen to understand why it's value is read-only when only accessed by a single thread? I'm sure I'm overlooking something obvious, but not coming to me atm.
Would it just make sense to stick with arcs and mutexes for multi-threaded web services. In Go, we use channels and mutexes like all the time when working with multi threaded software but I don’t see channels used as often in Rust
Admittedly I have no experience with channels in Go. From what I see in Rust, channels and Arc fill two different roles. Channels seem to be more of a websocket functionality rather than reference management. Feel free to correct me if I'm misunderstanding!
I'm glad you found a way to watch it at least! Everyone learns at a different speed. Also, I'm very nervous when making these videos, so that probably slows me down.
nobody feels these concepts are too much typing? I got it it's precise controlling and each concept has its purpose, but.. the code looks cumbersome already...
TF DID I JUST WATCH, my eyes are bleeding.. @Bocksdin Coding nice vid mate, but rust is absolutely bitch to learn , probably will have to watch like 6 times
I misspoke by stating that Box values are not guaranteed. I meant to say the 'next' value was not guaranteed.
😅
There is a common theme with so many of these with Rust videos. The authors spend loads of time explaining the various types, but spend ZERO time explaining when to use them, how they can help in solving common patterns and the potential problems when using them. Sorry to be so blunt. Perhaps focus on the WHY rather than the HOW.
@@dispatch-indirect9206Its not as simple as stack versus heap. Yes I can allocate on the heap using Box, but then should I pass an argument to a function using a Box or a reference to a Box? What about references? When should I use a reference? I'm a seasoned C++ developer and know the difference, but newbies coming from Javascript or Python land won't have a clue when to use Box versus reference, versus stack since it's all abstracted away, but in Rust land you have make the choice. Knowing WHY is much, much harder than knowing how.
@@dispatch-indirect9206 I think I need to rewatch this video! My understanding of Rust is much more advanced now than it was 6 months ago ! 😀
Can I just say how underrated this video is in terms of explaining Smart pointers so clearly and with simple examples!! ❤
Well done. You've really explained well and You've opened my eyes to how rust really expects the user to understand how and where their data lives in memory and ensure safety. Rust seems to be a good language however that boxing, referencing and arcing is way too much effort for me. I doubt I'll be using rust any time soon unless its a truly mission critical system that requires that level of detail.
I'll recommend this video to any one starting out rust.
thanks for the video. please dont put music, its very distracting
sorry i still got no idea what a weak ref is. the syntax noise is huge in rust
It's not noise, it's there to express your intentions to the compiler.
so awesome brother! just one comment: if you can mute the music in the background, it would be great for better focus.,
Ty bro helpful video!! A lot better than other vids
Thank you for watching!
Great video, thanks a bunch!
I had a question... Why would RC cause a memory leak and Weak wouldn't?
In case of RCs it will be a circular reference. There will be A that couldn't be deleted because it references B that references A. For more details you can read "Reference Cycles Can Leak Memory" in rusts doc.
I feel rust should just have wrapper function/macros for all this stuff to cut down on trying to figure all this out. I’ve literally had to make wrappers for a lot of stuff in this video and whoever is in charge of this stuff (rust foundation) they need to abstract a lot of this stuff. I like using rust for backend development but it’s sooo rough from hours of playing with the code that i feel i’m going back to use Arc, then that’s two much because i’m not using threads so use Rc to maintain that reference but hold on wait i need to be able to borrow and mutate, so here comes RefCell. Call me a hater. Idc. It’s time to sit down and condense the language down a bit. Hopefully that microsoft money does this. Rant over.
I feel ya. After using Rust for a while the issues are few and far between, though. Remember, the Rust ecosystem is still new. No language has everything everyone wants. C++ was released in 1985 and it still receives updates. If you find functionality you feel should be more widespread, you can always make a crate :)
@@BocksdinCoding I completely understand. I was just so frustrated (while coding) vanilla rust with the usual packages for a mock project and i was just saying to myself, this could be a macro, this could be a member function, why don’t they add this or wrap this with that but your right. It’s new and i kinda feel there are three generations of rust developers. The originals that probably started with rust & actually hold jobs in the language, the middle people, who caught rust when wasn’t moved over & they had created a package to use aws with but wasn’t official and then there is this generation where i swear to you i have not seen a lifetime for the backend unless i need a custom deserializer function for some reason because i’m using a derived Arc,Rc or something along those lines. I started in the middle & im here now. Again i hope microsoft comes through & really push it over the hump. The docs have improved for practically everything too. Even if it’s a rust book or something.
We can use Clone derive instead of Rc, can't that?
@8:30 area - for the tools field, could it have been a &mut Vec instead?
Update: nm, I see. The Rc needs immutable contents (thus it's fields will be too), so thus refcell.
curious - I understand why Arc needs to have immutable contents, but for Rc, it's single threaded only. Do you happen to understand why it's value is read-only when only accessed by a single thread? I'm sure I'm overlooking something obvious, but not coming to me atm.
thanks you!
Would it just make sense to stick with arcs and mutexes for multi-threaded web services. In Go, we use channels and mutexes like all the time when working with multi threaded software but I don’t see channels used as often in Rust
Admittedly I have no experience with channels in Go. From what I see in Rust, channels and Arc fill two different roles. Channels seem to be more of a websocket functionality rather than reference management. Feel free to correct me if I'm misunderstanding!
This is interesting but i need to comeback again to understand
Feel free to ask questions if you've got them 🙂
Unwatchable without at least 1.25x speed.
I'm glad you found a way to watch it at least! Everyone learns at a different speed. Also, I'm very nervous when making these videos, so that probably slows me down.
nobody feels these concepts are too much typing? I got it it's precise controlling and each concept has its purpose, but.. the code looks cumbersome already...
Perhaps, but most of the time you won't need to utilize these. That definitely depends on what your project is, though.
Too much typing??? It comes with the job. Pro hockey players don't complain about skating...
TF DID I JUST WATCH, my eyes are bleeding.. @Bocksdin Coding nice vid mate, but rust is absolutely bitch to learn , probably will have to watch like 6 times
guys, stop explaining things with linked list. no rust user uses it. it is a c culture thing. get over with it.