Rust for TypeScript devs : Borrow Checker

  Рет қаралды 232,924

ThePrimeagen

ThePrimeagen

Күн бұрын

Пікірлер: 563
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
Going from TypeScript to Rust can be very difficult. I sure hope you appreciate this video! I was thinking about making more Rust vs Typescript videos. What do you all think? This one is very educational, but i was also going to just do more comparison (not perf wise, but blazingly ergonomic wise). thoughts? Also, if you like this, SEND THE ALGORITHMIC SIGNALS
@yasintonge823
@yasintonge823 2 жыл бұрын
please do.
@gergelypaless5042
@gergelypaless5042 2 жыл бұрын
+1 :) great video!
@NathanHedglin
@NathanHedglin 2 жыл бұрын
LOVE IT
@duwangchew
@duwangchew 2 жыл бұрын
Honestly, I was expecting for potential solutions for the second example. I know there are multiple ways to achieve it, but even after months of trying to learn rust, even these simple interactions can become confusing really fast.
@mr_gryphon
@mr_gryphon 2 жыл бұрын
TS to RS playlist would be awesome!
@luisdourado9057
@luisdourado9057 2 жыл бұрын
Love the Rust vs Typescript video ideas. It makes Rust easier to understand when you compare it with Typescript and how things are working behind the curtain, your explanation is top notch, keep being great Prime Nice AD too
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
ty ty ty :)
@summerWTFE
@summerWTFE 2 жыл бұрын
@@ThePrimeagen yes, pls, more of this.
@user-qr4jf4tv2x
@user-qr4jf4tv2x Жыл бұрын
@@ThePrimeagen would love to see more comparisons videos
@geoffl
@geoffl 2 жыл бұрын
you've made a difficult subject simple. Well done.
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
ty ty :)
@lvgsredarmy8776
@lvgsredarmy8776 2 жыл бұрын
I would LOVE more “Rust for Typescript developers” styled videos. I just started learning Rust with advent of code as well, and have found a lot of things in Rust to be less scary because I know Typescript, while also finding plenty of things that *are* confusing 😂. This video was SERIOUSLY helpful, you have a fantastic ability to teach concepts like these. Thank you prime and happy holidays!
@tristuggla
@tristuggla 2 жыл бұрын
As many before has said, this comparison format (DX I guess) is super nice! For me, someone who hasn't had time to dive in yet but is wondering how the water feels it really hit a spot. More of this stuff please!
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
yayaya
@SIMULATAN
@SIMULATAN 2 жыл бұрын
I subscribed, and it's so much easier to understand the borrow checker!
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
of course
@scottiedoesno
@scottiedoesno 2 жыл бұрын
Doing AoC with Rust really has been the best way to practically learn these things. Loving learning this awesome language!
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
agreed
@basudevadhikari22
@basudevadhikari22 2 жыл бұрын
I learnt rust during first lockdown for around a month, and almost never touched after that. It was sort of like revision. You did fantastic job explaining important yet confusing concept in simplest way possible.
@Дмитрий-о8м9с
@Дмитрий-о8м9с 2 жыл бұрын
Me (JS/TS dev): start learning Rust. Primeagen: makes video "Rust for JS devs". Love it :)
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
you are welcome
@ethanwilkes4678
@ethanwilkes4678 2 жыл бұрын
Wow, the borrow checker blew my mind time after time after time. I felt like I was really stuck in a rut and unable to move forward. That is, until I clicked the subscribe button. Suddenly, everything just clicked. Really revolutionary
@harsha1306
@harsha1306 2 жыл бұрын
Wow that last example was perfect. Thanks for doing this prime! It makes it so much clearer!
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
yayayayaya!
@AlFredo-sx2yy
@AlFredo-sx2yy 2 жыл бұрын
@@ThePrimeagen yayayayaya
@cryodawn
@cryodawn Жыл бұрын
@@ThePrimeagen yayayayaya
@JamieMG_
@JamieMG_ 2 жыл бұрын
I've been struggling in Advent of Code in Rust and the bit at 06:04 sums up perfectly why - Not knowing if a std function, usually an iterator method, mutates in-place or returns a copy. It leads you to a thorn bush of compiler errors. I guess this is just something you learn over time doing Rust? New merch idea - make a cheatsheet for this, and print it upside down on a T-shirt!
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
so for the most part its pretty simple to know about iterators. &object_that_can_iterate = .iter() = immutable references to items within object_that_can_iterate = .into_iter() = converts object into an iterator (consumes) .iter_mut() = mutable references
@JamieMG_
@JamieMG_ 2 жыл бұрын
@@ThePrimeagen Oh lord I've just been using the first one, this makes all the difference! Thank you Mr Prime.
@pif5023
@pif5023 2 жыл бұрын
I cannot understand why people say that the borrow checker is complex, it does what a C/C++ programmer should be doing when using pointers. Rust people found a brilliant way to automate that reasoning inside tools.
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
correct
@pif5023
@pif5023 2 жыл бұрын
@@ThePrimeagen 0:49 it all makes sense! I could understand the borrow checker because I am subscribed!
@tylerlaprade642
@tylerlaprade642 11 ай бұрын
Thank you @ThePrimeagen, a year after you made the video. I've been going through Advent of Code 2023 (I know, I'm slow) to try to learn Rust and foolishly only did a couple chapters of The Rust Book before switching just to solving problems. Especially with Copilot's assistance, I've been able to work out how to add `&` and `mut` to make my code compile, but I didn't understand _why_ until this video. I had to rewatch every lesson of this video 2-3 times, but now I feel I finally understand this concept that was repeatedly tripping me up.
@MrSpiftire
@MrSpiftire 2 жыл бұрын
I recently came across a blog suggesting to always make your arrays read-only in typescript. This has really helped med to avoid all the inplace array functions screwing up my data when it's not intentional. It also behaves more like rust immutable arrays. Great video. Keep it up 🤙
@fuhrmanns
@fuhrmanns Жыл бұрын
Thanks, perfect explanation on a complex subject!
@maxverb
@maxverb 2 жыл бұрын
These three types of values in rust (owned, reference, mutable reference) reoccur everywhere in the language. For iterators, we have .into_iter(), .iter() and iter_mut() for the same three types. For functions we have FnOnce (consumes the value, can therefore only be called once), Fn (takes a reference: can therefore be called multiple times), FnMut (takes mutable reference). It's a very nice language design.
@cherubin7th
@cherubin7th Жыл бұрын
Languages like javascript, where everything could happen and you need to know it, give me anxiety.
@arcstur
@arcstur 2 жыл бұрын
You made me start to learn Rust and I'm loving it. Currently finishing chapter 10 of the book woohoo
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
nice
@boyonline1994
@boyonline1994 2 жыл бұрын
Hi, could you give me the name of book you're reading?
@alaouiamine3835
@alaouiamine3835 2 жыл бұрын
@@boyonline1994 the rust programming language
@alaouiamine3835
@alaouiamine3835 2 жыл бұрын
@@boyonline1994 it's a website
@arcstur
@arcstur Жыл бұрын
Finished the book yesterday, it is really good! Now, let's go to The Cargo Book :D
@thejackimonster9689
@thejackimonster9689 Жыл бұрын
So effectively Rust moves ownership of a value by default (likely to optimize end-recursive functions in a similar way as Haskell) and it makes all variables immutable by default. In comparison C/C++ copies a value by default and makes all variables mutable by default. So that explains why going from it to Rust creates such a headache until you get through this. Anyway good video to understand the concept.
@boreddad420
@boreddad420 2 жыл бұрын
started learning rust due to some thick js fatigue and have to say when I code in rust I finally feel like I can write code with at least some certainty that it'll do what I want it to do
@alexroman8878
@alexroman8878 Жыл бұрын
Yes. The same when I switched to Go. I stoped playing the game “so what shit will break today?”
@thegalluzz
@thegalluzz 2 жыл бұрын
First explanation of the borrow checker that actually makes sense, tried a couple of days ago asking chatGPT to rephrase it multiple times with no success, probably not enough blazing speed and momentum
@atxorsatti
@atxorsatti Жыл бұрын
Learning c and c++ and it sounds like how shared pointers and unique pointers planned to work but no one thought them through
@cparks1000000
@cparks1000000 Жыл бұрын
The easiest way to beat the borrow checker is to write immutible code and pass by reference. Your debugging team (typically consisting completely of future you) will thank you.
@inconnn
@inconnn Жыл бұрын
The Rust Book actually explains this pretty well when I read it.
@akashdeepnandi
@akashdeepnandi 2 жыл бұрын
Prime has covered it quite well, a few days ago I was thinking I should try rust and I did and I love it. I am following their docs religiously, those who haven't checked out their official docs, these topics are covered there in detail as well. But always thankful to Prime to share this with everyone.
@lwlhectorlwl
@lwlhectorlwl 2 жыл бұрын
Started learning rust and this is one of those things that were somewhat hard to understand having a background mostly with Go. Loved the video
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
yayaya
@AlFredo-sx2yy
@AlFredo-sx2yy 2 жыл бұрын
@@ThePrimeagen yayayayaya
@ietsization
@ietsization 2 жыл бұрын
Having written quite a bit of C++ code, it is extremely freeing to have the compiler check things like ownership. Not only does it make code the more safe, it also becomes more difficult to make dumb architecture decisions.
@ambuj.k
@ambuj.k 2 жыл бұрын
Just came here to say, I got inspired to learn rust because of you and NoBoilerPlate; I invested a month in reading the book and now I am learning actix and building a production ready backend in rust. I came so far from javscript to rust because of you, I appreciate you!
@stanrock8015
@stanrock8015 Жыл бұрын
I'm down for the borrow checker. Doesn't bother me at all. Great video. maybe I subscribe as Rust is new into my toolset. Complete beginner on Rust
@guilhermerodovalho9988
@guilhermerodovalho9988 2 жыл бұрын
Great video as always. Would love one about lifetimes. They are the one concepts that I struggle the most in Rust
@manuillo94
@manuillo94 Жыл бұрын
Just wrote my first Rust thing and it is a native app using Tauri and Yew. This video and many more you have about Rust helped me a lot. Thanks men
@snoopy8870
@snoopy8870 2 жыл бұрын
ThePrimeagen is the best teacher .. i swear to god!.
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
ty ty
@hacktor_92
@hacktor_92 2 жыл бұрын
1:55 - it just clicked in my mind (after 2 years of casually coding in rust): the "use of moved value" can roughly translate to "use after free" error in c / c++, because you're passing ownership of `item` to `print_out_item`, as that function consumes it and rust frees the memory for `item`; therefore, you're trying to use a variable after it's freed from memory. and that's a safety rule that rust enforces you to take into account. and that's why i mostly pass variables by reference and prefer to use `.clone()` as a last resort.
@ShilohFox
@ShilohFox 2 жыл бұрын
Had multiple “aha!” moments during the span of this short video. Very concise and to the point. Thank you lots for this, it’s very helpful!
@naung01
@naung01 2 жыл бұрын
I started the first few advent of code problems using typescript, I was just starting to try out using rust for the rest of the advent, so this video came just in time. Thank you!
@zackchen6280
@zackchen6280 2 жыл бұрын
I didn't understood the borrow checker until I subscribed. Thank you Primeagen, you saved my life
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
you are welcome
@Nintron
@Nintron 2 жыл бұрын
Papi Prime getting a sponsor 😱 good for you!
@ThatJay283
@ThatJay283 8 ай бұрын
7:55 in many languages we have const, in rust we have mut. rust is just const by default
@aleksandrbalev5368
@aleksandrbalev5368 2 жыл бұрын
The moment I subscribed on this channel I got all knowledge of Prime and an immediate offer from Netflix. Thank you so much Prime!
@joseph0x45
@joseph0x45 2 жыл бұрын
I just started learning Rust, I'm having a hard time understanding some concepts but I'm loving it. Make more videos like this one plsss :)
@everkosus
@everkosus 2 жыл бұрын
I can confirm that the borrow checker was a mystery to me until I subscribed. Once I did, it was as if the crab god directly uploaded the knowledge to my brain. 10/10 would do again.
@htspencer9084
@htspencer9084 Жыл бұрын
God yes, the number of times in languages where I'm like, "hang on, am I passing a reference or the value here? Welp, just gotta find out!" is silly. I love that rust not only makes it clear, it gives you the choice!
@jonispatented
@jonispatented Жыл бұрын
This is the first ThePrimeagen video KZbin has ever recommended me. I have been binging ThePrimeTime videos for MONTHS and THIS is the FIRST video KZbin shows me of ThePrimeagen!? But in all seriousness, I guess I need to just learn rust now.
@softwareadministrato
@softwareadministrato 2 жыл бұрын
Wow, subscribing actually helped with understanding of Borrow Checker...even if I don't know any rust yet...
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
its a big improvement, its wild huh?
@wlockuz4467
@wlockuz4467 2 жыл бұрын
This is the first time I actually understood what is the Rust borrow checker. My intuition is that its a mechanism that forces you to write safe code but at a much lower level. Kind of similar to how TypeScript forces you to write type safe code. Now I just need an excuse to learn it further. But being in web land I doubt I'll have it soon.
@caerphoto
@caerphoto 2 жыл бұрын
You can totally do backend web dev with rust - check out the Axum framework.
@andrewalbrecht4547
@andrewalbrecht4547 2 жыл бұрын
This is amazing and succinct. I literally gave a presentation on this to my company last week (we're primarily Java/JavaScript developers) and it was pretty much beat for beat. Granted I took 30mins instead of 8, but there were a lot of questions 😁
@kaidenrogers
@kaidenrogers 2 жыл бұрын
I litterally asked GPT-Chat, like 14 hours ago, to show me, a TypeScript dev, a program in both Rust and TypeScript to help me understand this. And this comes out, Thank you!
@willi1978
@willi1978 2 жыл бұрын
so GPT-Chat told Primeagen to make this video
@kaidenrogers
@kaidenrogers 2 жыл бұрын
@@willi1978 That's the only logical conclusion.
@antoniong4380
@antoniong4380 Жыл бұрын
6:32 I Extremely agree!! Oh, heavens!. When I was first starting to learna language (scripting language) of AHK, I was traumatized by the odd behaviours I had to find through trial and error while working with objects like arrays. The second language I had turned into learning better than just basics was actually rust, and even though it was an about 3-4 months struggles (about 1-4 hours daily on average), It was really pleasant to learn because It was clearer to know what I actually was doing. Now my next pain I'm feeling in rust are web servers (Still reading chap 20), Macros and Iterators
@DNA912
@DNA912 2 жыл бұрын
I did some leetcode today and was doing some Rust and C, and I thought about why I like to use rust, C often goes faster to get something to work. And it's because when you write rust code, it takes a while to compile and work, but that's because the compiler more or less forces you to understand what is going on behind the scenes, Like in your last example with the reverse and map. To implement that type of logic, you pretty much NEED to understand what to code does to get it working. Whiles in many other languages you can often get away with code that's: " I don't really know how it works, but it works so I'm happy".
@naterardin8053
@naterardin8053 Жыл бұрын
Always a good day when I find a new KZbin channel this great. I'm usually a documentation > video tutorials kind of guy, but it's hard to beat content this good.
@quintondeanmusic
@quintondeanmusic 2 жыл бұрын
This is a great talk. I made a small similar post about this for my company, about how Rust checks these things and how coding like this helps us think about how to program better in other languages. Incoming thought dump: We've been having issues in Grails with an exception called Stale Object. Essentially a reference to a database Domain is getting passed to a service function, mutated with a save(), then outside and after the function that same object is getting mutated with a save(). Groovy lets us compile this code and normally this actually works most of the time. This is a data race. Because it's working with the Database this is an asynchronous process that gets obfuscated and we dont see it. We get this error when things don't catch up in time and the outside object gets updated first followed by the inner reference being updated. Incomes Rust, if you tried to write the code the same way you'd get borrow checker issues because we tried to hold onto two mutable references at the same time. Showed this to my coworkers and they were kinda blown away that a language and compiler can tell when a data race happens. Imagine, no more data races. No more unknown BS in your code base. Rust is hard, but most of the time it is correct! And I can use libraries written by Rust authors knowing it is going to work and not worry about some weird bullshit breaking prod code. Long live crab
@micoberss5579
@micoberss5579 2 жыл бұрын
This video taught me what borrow checker is BLAZINGLY FAST
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
Absolutely right
@fstew1
@fstew1 2 жыл бұрын
can confirm, I only fully understood borrow checking after subscribing, it was like a door was unlocked and I walked through into a beautiful landscape of full understanding
@reilandeubank
@reilandeubank Жыл бұрын
Very good video, I never quite understood what the borrow checker was doing until now. The one thing that confuses me, however, as predominant C++ user, is that I am used to "pass by value" meaning that you pass the value into a function and any changes made in the function won't be applied to the overarching object/variable, and pass by reference allows you to directly access the object and change it. Interesting!
@saurabhshinde1855
@saurabhshinde1855 2 жыл бұрын
Best tutorial ever on borrow checker.. Finally gained some confidence on the same. Thank you so much Primeee...
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
yayaya
@AlFredo-sx2yy
@AlFredo-sx2yy 2 жыл бұрын
@@ThePrimeagen yayayayaya
@ikarosouza
@ikarosouza 2 жыл бұрын
People complain about side effects and then proceed to complain about a language that throws in your face when you're about to create a side effect
@jongeduard
@jongeduard 2 жыл бұрын
Yep, this is indeed amazing. I am a developer in multiple languages, with a main focus on C-family languages (especially C#, but also C/C++, JavaScript and Java). So I have seen a lot of things, but what Rust does is certainly special. Everything Immutable by default in combination with memory ownership by default. While still doing many things by-reference a lot like what people do in C++. Such that performance is maintained. Amazing. I have very recently started to experiment with Rust and I am planning to do a lot more with it. Also taking into account some other thoughs and considerations. This language has absolute potential, even though it's also still missing some features, like varargs.
@mharbol
@mharbol 2 жыл бұрын
I was struggling with learning Rust, particularly the borrow checker. But then I subscribed and it all clicked
@etroch
@etroch Жыл бұрын
Smashed that subscribe button and suddenly I'm seeing in 4K, understanding quantum physics, and speaking fluent Mandarin... I guess this is how Bradley Cooper felt in Limitless!
@looming_
@looming_ Жыл бұрын
I really love the rust book. Concepts like these are explained quite well.
@amanksdotdev
@amanksdotdev 2 жыл бұрын
not bad for first ad, though i can see more dramatic versions in future like ltt
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
agreed
@daltonyon
@daltonyon 2 жыл бұрын
Clear like water, awesome Prime!!!!! I think a good topic is async in Rust vs Typescript, without TOKIIIOOOOOOOOOOOOOOOOO of course and the more simple way!!!! Thank UUUUU
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
yeah. tokio is shockingly simple once you get the paradigm :)
@musdevfrog
@musdevfrog 2 жыл бұрын
Short. Compact. Informative. Three pages of the Book in 9 minutes.
@jjferman2587
@jjferman2587 2 жыл бұрын
Wow, I subscribed and now I totally understand Rust! It’s that easy!
@JeremiahLangner
@JeremiahLangner 2 жыл бұрын
Ironically, working through "the rust book" and interacting with the borrow checker helped me understand how to use TypeScript as opposed to the other way around.
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
yeah, most people just simple don't know what is happening.
@faysoufox
@faysoufox 2 жыл бұрын
Basically variables passed to functions are c++ const by default and can be passed to a function only once unless passed using a reference, else the variable is owned by the function once it's passed. And to pass a variable several times to different functions and modify it (which is not functional programming but can be useful to avoid copies when needed) the variable needs to be passed as &mut.
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
the problem about c++ is pass by value this catches many people off guard. even worse is this auto a = std::vector() auto b = a; BOOM copy. WHA???? c++ always has the worst defaults. Rust solves this very well.
@kunodragon4355
@kunodragon4355 Жыл бұрын
I was having trouble understanding this video. Thankfully, I subscribed, and now everything is clear!
@therealPDOT86
@therealPDOT86 2 жыл бұрын
0:47 lmfaooo genuine comedy brother
@zyansheep
@zyansheep 2 жыл бұрын
idk why i'm watching this video. I've been coding in rust for 3 years and know all this stuff. i guess ThePrimeagen is just too good of a teacher I want to re-learn what i already know
@jhonatanjacinto
@jhonatanjacinto Жыл бұрын
That was amazing. At the end, this borrow checker thing is not that hard to grasp at all (once you have some experience with programming in other languages, of course). I also like the idea of explicitly say in the code what is mutable and what is not. That is a plus for Rust indeed. That makes code much clearer and predictable, I believe. Good job, Prime!
@bernardoalves3642
@bernardoalves3642 2 жыл бұрын
Understanding Borrow Checker with Primeagen is so easy I now borrow without checking. Or something. Learning Rust when you are a Prime subscriber gets so trivial that the only thing that is Rusty nowadays is my JavaScript, which is what the language is by default, rusty. You get the point, just subscribe to the guy. We need to subscribe until we find out why Maria did what she did. PorqUÊ.
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
MARIA%V???
@TheNewton
@TheNewton 2 жыл бұрын
Great concise vid, good example of compiler jock jargon vs pedagogy problem. A tl:dw might be 8:12 borrow checker == abstract way of doing mutation opt-in enforcement Maybe the concept should have just been called "reservation" or even "hold" instead of borrow to be more clear. The term itself borrow implies to the naïve that things are put back automatically when the thing borrowing is done. Which gives a sense that something like print(var) print(var) should work but when it doesn't work that makes it seem as if those commands are running simultaneously and that's the reason they cannot borrow the same thing at that exact moment which is a bad intuition for new learners now thinking where are the docs to "unborrow" ; which confusingly just leads to a macro.
@made4yo
@made4yo 2 жыл бұрын
@ThePrimeagen wants to "reverse()" all the javascript developers into rust :)). Love your videos and your passion :D it's contagious
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
tytytyt!
@Miginyon
@Miginyon 10 ай бұрын
So true, I didn’t understand the borrowchecker, subscribed to your twitch and then got it, first time
@whitefluffycloud
@whitefluffycloud 2 жыл бұрын
The king of dev content nowadays. Appreciate all the education and entertainment!
@Al-ws7cn
@Al-ws7cn 2 жыл бұрын
Man, great video! You explain things very well; clear and concise. Would love to see more of these.
@apefu
@apefu 2 жыл бұрын
I have never written a line of rust, barely touched typescript. However, this makes a ridiculous amount of sense if you've completed all the side quests using pointers in C. Maybe I'll actually write some rust code one day. If I do it will be because of stuff like this. Very cool.
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
awesome!
@CodeWithCypert
@CodeWithCypert 2 жыл бұрын
You do a great job of being fun and entertaining while also being extremely informative and educational. Great stuff!
@akhileshchander5307
@akhileshchander5307 2 жыл бұрын
The reason of the less rust developers, we don’t have content like this, I hope it will increase rust community some day
@arcanernz
@arcanernz 2 жыл бұрын
I was so confused then I subscribe, now I’ll writing a multi-threaded wait-free red-black tree algorithm in Rust. Thanks @ThePrimeagen.
@josgraha
@josgraha 2 жыл бұрын
whoa, subscribing like opened up my brain to understanding primeagen concepts, thanks dawg. 👍
@keertirajmalik
@keertirajmalik Жыл бұрын
what plugin do i have to add in Neovim to get the function information while I am writing the function shown at 7:12
@st-jn2gk
@st-jn2gk 2 жыл бұрын
Is that background at 00:04 from the website of the dude with the glasses that contributes to the t3 stack a alot...
@jonashansen2512
@jonashansen2512 2 жыл бұрын
Didn’t know mutating by reference was called borrowing, that’s when it clicked for me. Thanks Primeagen :)
@thedreadedgman
@thedreadedgman 2 жыл бұрын
since I was subscribed already, it's so much easier to know the borrow checker completely
@thegenxgamerguy6562
@thegenxgamerguy6562 2 жыл бұрын
I'm coming from C# but this is VERY helpful for me as well. I want to write some system stuff in Rust. Seems to be the best language currently for this type of work.
@hypergraphic
@hypergraphic 2 жыл бұрын
For someone who doesn't really do tutorials, you make a good tutorial :)
@seltox6320
@seltox6320 2 жыл бұрын
Oh wow, I didn't understand the Borrow Checker, but then I clicked Subscribe and now it all makes sense!
@ThePrimeagen
@ThePrimeagen 2 жыл бұрын
i knew it!
@jamesmarx
@jamesmarx 9 ай бұрын
Can confirm. Subscribing did in fact help me understand the borrow checker.
@farzadmf
@farzadmf 2 жыл бұрын
SUPER nice explanation (didn't expect anything else when I started watching)
@alex-v7e6v
@alex-v7e6v 4 ай бұрын
brilliant, thanks a lot. Comparing to typescript makes it so much easier! thnaks a lot
@lukaszsawon8576
@lukaszsawon8576 2 жыл бұрын
This is genius, actually. The best way to spread love for the language is to teach it
@flacdontbetter
@flacdontbetter 2 жыл бұрын
Just started learning rust while doing AOC and I haven't had so much fun since I started programming years ago!
@Ked_gaming
@Ked_gaming 7 ай бұрын
This is pretty clear, my issue right now is passing immutable stuff into async closures
@mishahrokhola1289
@mishahrokhola1289 2 жыл бұрын
Very cool video. I'm fun of "typescript", but "rust" with its explicit keyword about mutation makes me think I could fall in love with this language. Don't know rust btw, but want to start learning it after watching this video))
@bertrodgers2420
@bertrodgers2420 2 жыл бұрын
I like that, it seems like a compiler-level CommandQuerySeparation pattern. I force that pattern in our team's coding guidelines as - like you say - it's pretty terrible when you don't know whether a function will mutate the args or not Ta
@MrHopran
@MrHopran 2 жыл бұрын
As someone who writes code in TS for a living and is now trying to dabble with Rust, this couldn't have come at a better time. I'm trying to write all of this year's advent of codes in Rust and yeah, the beggining may have been a little rusty (sry) but I feel like I'm getting the hang of it.
@void_star_void
@void_star_void 2 жыл бұрын
Great video, I have a feeling it's not gonna fix problems, one day you join a company excited to work on a rust project and then open it up and see everything is a mut :)
@ukaszwosek7370
@ukaszwosek7370 2 жыл бұрын
How did you get those inline debug messages? Would be very help full as getting errors each time I write one extra line :D
RUST Enums ARE Better
5:49
ThePrimeagen
Рет қаралды 147 М.
Async Rust Is A Bad Language | Prime Reacts
28:46
ThePrimeTime
Рет қаралды 110 М.
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Rust for TypeScript Developers by ThePrimeagen | Preview
14:59
Frontend Masters
Рет қаралды 99 М.
why rust libraries may never exist.
7:26
Low Level
Рет қаралды 288 М.
Rust makes you feel like a GENIUS
10:48
No Boilerplate
Рет қаралды 413 М.
How I Made JavaScript BLAZINGLY FAST
10:10
ThePrimeagen
Рет қаралды 224 М.
Facebook Recommends Rust?
5:10
ThePrimeagen
Рет қаралды 115 М.
Rust Foundation IS DOING WHAT????
8:17
ThePrimeagen
Рет қаралды 339 М.
This Is How Rust Stops Memory Leaks
5:53
Low Level
Рет қаралды 169 М.
but what is 'a lifetime?
12:20
leddoo
Рет қаралды 83 М.
What Next...Finding a New Job In Software
3:45
ThePrimeagen
Рет қаралды 187 М.
How to fight Rust's borrow checker... and win.
8:29
Let's Get Rusty
Рет қаралды 46 М.
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН