Rust: What is Ownership and Borrowing?

preview_player
Показать описание
One of the biggest hurdles for those learning Rust is the whole concept of ownership and borrowing. It can be a little tricky to understand, but once you do you will understand why Rust is called a memory safe language.





#garyexplains
Рекомендации по теме
Комментарии
Автор

Hey Gary, your 2 Rust videos are simply the best for new Rust programmer so far in my opinions. Thank you very much for these helpful videos.

infinikeys
Автор

at 1:23, the error refers to using-after-move, since the string was moved to s2. I believe that the original "hello" literal string stays in static memory, and as such this literal string is not really owned by anyone.
So there is the literal string "hello"; there is also s1, which was a heap string "hello", and later that heap string is moved to s2.

swfsql
Автор

I loved your ARM video, Gary! Keep up the amazing technical dives :D

theJesai
Автор

Really appreciate the two videos, sir. Love your style of explanations. Best for people with some basic knowledge of C/C++ to get upto speed. You could probably make a course out of this <3 It's just sad that the language is yet to be mainstream cause clearly the lack of views is not because of you.

shafayat
Автор

Very nice video, you really made the concept clear and understandable, nice!

Gordolone
Автор

Very good you are doing more Rust videos, I enjoy them !

autohmae
Автор

Gary, this is excellent, the best explanation I have seen. Thanks for making such useful videos

RaxTubeYou
Автор

Really useful video, I just started looking into Rust

itssanchez
Автор

The ending of a scope in rust is not when the variable was last mentioned, it is when the scope ends that the owner of the variable was declared in or moved into. (With a })

hansdampf
Автор

One of the best explanation of RUST ownership and borrowing that I have seen

tanuvishu
Автор

I find the videos you share very helpful. Thanks a lot.

besher
Автор

thanks alot! if you can do more rust videos!

dracula
Автор

It's weird that unsafe code is preferred to cloning. I know heap operations are expensive but why sacrifice safety for speed?

daviidon
Автор

rust & risc-V & blockchain thing . any relation on it ??

wprayudo
Автор

Amazing video, love it. I really want to learn rust and I am really excited about redox os future

corlaez
Автор

about pointers / references, isn't it that in c++ we have pointers AND references (the latter cannot be changed to point to anything other) and Rust uses references only?

mhnatiuk
Автор

Is there any way to explicitly unborrow something? What if you're in multiple threads?

mikicerise
Автор

Great explanation. More videos please 🙏🙏

abhisheksinha
Автор

Iirc the borrow once from a structure will be addressed in the upcoming edition (2021) 🤔

hansisbrucker
Автор

Why use
&mut string_value

Why not

&string_value
?

drac