This is an intro to the language. It is long but we go over a lot. Web Assembly with Rust is next. Also guys, check out Eduonix, they are giving my subscribers/viewers an awesome deal on courses. TIMESTAMPS: Intro - 1:05 Install Rust - 4:45 Creating a file - 6:26 Cargo Init & Build - 7:50 Print & Formatting - 10:42 Variables - 19:35 Data Types - 25:15 Strings - 33:42 Tuples - 44:34 Arrays - 47:14 Vectors - 55:00 Conditionals - 1:16:00 Loops - 1:07:03 Functions - 1:13:53 Pointers & Reference - 1:19:14 Structs - 1:22:00 Enums - 1:37:59 Command Line Args - 1:42:00
Rust is NOT garbage collected! The assertion at 3:55 is false. Rust has completely deterministic memory management, enforced at COMPILE time. There is no freeing up after reaching a "threshold". This is like, one of the key things of Rust.
@@FreeScience But then he goes on to explain how Rust works. But what he explains is not reference counting and automatic memory management on the stack. Instead, what he explains sounds very similar to how GC works. He is basically contradicting himself, which is confusing.
The C++ of 20 years ago (C++98) is a different beast from C++17/20. They often look so different, that without knowing, they don't even seem to be the same language but rather like C and C++ when compared.
Meh. Rust is not that kind of "pratical" language. You need to understand it well or you're going to get frustrated at the compiler errors because you won't be able to understand them.
@@brainplot Still you need to have an entry point. I've been wanting to learn rust for a couple of years now, but all the lack of accessible resources has turned me away ever single type up to know. To learn means to take something you don't know, and try to make it known, and from that point on you can venture deeper. That's especially true for programming since an inside out approach isn't really viable with the sheer amount of complexity you'd first have to master. I agree that it is important to learn all of this, but it's easier to do it from a point of partial knowledge to be able to put into relation
@@zeberast I learned Rust from the book. I was only watching this video because I'm interested in Rust and this ended up in my recommended videos. What's wrong with the book? It seemed pretty accessible to me.
I'm at 1:34:21 and I just want to say that you're awesome. I've had a really hard time learning Rust because the way I learn best is to learn enough not to be overwhelmed, then throw myself in the deep end. Thank you so much. edit: Just finished. Thanks again!
Rushing through rust docs these days to get hands on to this new language and saw your video. Good work Brad I'm going through it right now 😂💪 #devtubers
FINALLY, someone who knows how to teach this dam language. Thank you for having a good and clear tutorial for RUST I wish more people explained codes this clearly.
Love Traversy's tutorials, been using them a lot lately and they're a great resource. I also love how Brad always sounds like he got into the office late and started recording it immediately.
A really great intro! I will say the technical quality of this video is amazing. Great mic, video quality, readable font size. It sounds simple but I know it's hard to do well -- cheers!
This is a great intro, Brad! I've tried so many "intro to [language]" tutorials that are just so slow and boring, and I liked the pacing of this video. I'm excited to learn more about web assembly from you, as I'm learning what I can to be prepared for the future. It's definitely a different beast from just regular JS.
Doesn't Rust support variadic macros and if so than why isen't the println! macro using it. And if not why doesn't Rust support variadics as it seems quite essential.
Brad , i'm in this industry for 12 years ... and i'm learning day by day ... i can't imagine how come do you know all this things lool .... you are like a machine bro :))
Thanks :) It depends on what you mean by "know". If we are talking fundamentals and enough to create a small project, maybe 12 languages. Enough to work as a professional dev with, I would say 4 or 5. This is just actual programming languages not frameworks, libraries, standards, etc..Once you learn a couple languages, it is easy to learn more, at least on a fundamental level.
dude i was to going to ask the exact question lol.. i always tell my friends " dude there is this youtuber "traversy media" he knows mostly every frk'n language
@@TraversyMedia you are one of the most honest developers in the world :D Any senior software developer knows that knowing a language syntax doesn't mean being able to develop software professionally in that language. Mastering a language (which means beeing able to use it professionally) requires knowing and mastering the most important language's libraries and frameworks and the tooling. In my opinion this requires at least 1 year of full professional development in that language. So, you are really really honest.
@@albertoplebani77 true that! i learned over 20 languages, where i know syntax, keywords and so on without looking up... but there are only very few languages I really mastered...
As usual, amazing stuff Brad. You have me really thinking of whether to start with Rust or Golang. I wonder if anybody reading this would like to give their two cents on which one they like better.... Thank you Brad, and everyone, who comments. UPDATE: Screw Go!!! I'm really diggin Rust. I one of the 5 people, who enjoyed C++, and this is very comparable, but better. Thanks again Brad for opening my eyes.
Hi Brad. I haven't seen any of your other videos. Stumbled upon this one, and it's awesome! Love how hands on it is, and how you share the code so i have plenty of snippets to refer back to and mess around with! Looking forward to similar videos covering more advanced stuff, cheers!
I appreciate this was already a lengthy video, though there were a few things I was confused about where a brief explanation of each (or why it's a longer conversation) would have been helpful: - The difference between const and an immutable let and why you would use one over the other - Why fn full_name has "&self" (referenced) as an argument but to_tuple has "self" (unreferenced) as an argument - What a macro is - Why you used .clone() in the final section Otherwise thank you for a very useful intro video that has spurred me to look into Rust more.
const can only be used for constant expressions, that can be evaluated at compile time, so you can't assign a value from a function call to const variable
To be honest, you are one of the best UA-cam instructors in the game. Your Haskell video was superb and this is right up there, best in the backend UA-cam game by far!
54:40 it would have been good to address the "oddity" that a slice [0..2] or [1..3] only returns two items (0 & 1 or 1 & 2 respectively) When reading it as _"element zero _*_to_*_ two"_ then the statement is wrong. It's rather a right-open interval [ 0 ; 2 [ (indexes zero to - but not including - two). 1:12:15 the same goes for the range in a for loop - the upper bound is exclusive, hence the two examples (while vs for) are *not* doing the same thing. The former goes from 0 to 100 (including) and the latter _only_ to 99 - something also worth mentioning.
This video is precisely what I needed. Although long, it is direct and explains the basic concepts in a logical manner. Thank you very much for your effort. This old C++,C,Python, Perl, java, assembly language old dog has learned a few new tricks.
You remind me of myself in a way. I struggle with a lot of the things you talk about in your other videos and feel I'm at the point you were at when you started all this. You definitely inspire me, keep up the videos, love it. I listen on my 1hr commute every day.
This is excellent content, easy to follow and exactly what I was looking for as a Java/C#/JS developer looking to get started in Rust. I really need your Rust + WebAssembly course so I'm subscribing so I see it when it lands!
Not particularly interested in Rust but I have watched it anyways, I have also worked on several of your courses and man do you deliver. Compared to other courses paid or otherwise out there, the difference is light and day. You present the material in a thoughtful and precise manner, no pauses or uhms or whatnot, you know what you want to demonstrate and proceed to do it in a calm and controlled manner. Please do a complete 70-483 course, I would gladly pay for it!
@@Mossmyr C/C++ and Rust share the same memory behavior. Both offer the same ability to use memory in unsafe ways, and both discourage that behavior. Rust's toolchain discourages unsafe behavior more actively whereas C/C++'s toolchains may only provide short warnings about the behavior. It's worth noting that C and C-style C++ will naturally lead to more more opportunities for errors; but it's worth remembering, it's not the language's fault when theres an error, it's the programmer's. Rust is great because it helps the programmers make fewer mistakes by default. To get the same level of support with C++, you often need additional static analyzer and warning level configuration for your compiler.
@@SiliconLight With C++, you also have the problem that the "best way" to program in C++ can look like alot of things are "bolted" onto the language due to legacy. This is not the fault of C++, but to wanting to stay back compatible + new insights people get. And Rust takes the fruits of those insights. C++ is hard, because you not only need to know the "good way" to program things, but also the bad ways to fully understand everything and to avoid pitfalls which the compiler doesn't complain about. Rust is just lessons learned from the past 40 years + guard rails and the way you program that is the most easy is mostly the best way to do stuff. With C++ the easiest way can be the wrong way. Also move semantics in C++.... i think those things are easier in Rust to deal with memory issues. C++ will stay here, but it has battle scars and warts that you can't remove without making people mad about not being back compatible anymore. And tell me the truth... with soon 64 and 128 cores to be normal. You want to write multi-core programs in C++ or Rust for so many cores? Rust is the only Systems language that makes you feel confident of your multi-core application.
As a Rust Noobie I have a learned a lot. A lot of things are very similar to C++ but a lot of other things are also very different. Thank you very much from 2021 :)
Wuaah that language are impressive, I've done many c++ before, and some functional languages. And I.m very familiar with syntax and logic of this paradigm. This is my next 5 year of my future 😂
4:12 Noone allocates memory manually in C++(using malloc or something), only in very rare special cases! C++ has classes in the stdlib which abstract all of that away. That is the greatest myth about C++, its simply not true.
This please. If your goal is to make a Rocket API for GETing and POSTing text, it's a breeze to use. For anything more advanced, the documentation is severely lacking. I've even reached out to Sergio Benitez himself, who was not interested in clarifying anything.
was able to go through the complete video , along with the programs , . It was a great video. No time wasted at all. Extremely helpful . A definite subscribe and like
Quantum only has pieces that are built in rust, mainly the css engine. The browser built completely in rust is called servo. The plan is to eventually replace all of the c and c++ but it's not there yet.
By far the best thing about Rust is “cargo bootimage” - very easy to use Rust to develop OS kernels, although this requires the nightly instead of the stable channel and also requires the core library instead of the standard library. Also, one needs to set up the automatic memory management in order to use it in this case - thankfully that’s rather easy thanks to Cargo and the “alloc” crate. The os.phil-opp.com tutorial is a fantastic springboard for those who want to get to a level that low after watching this - although I haven’t seen any video equivalents to that tutorial (yet).
Although this is a relatively good tutorial, it covers the surface level only. There is mostly summarized information about the syntax of the programming language here. This lecture goes little into how or why the language works the way it does, which I think is one of the key things to learning Rust.
Fantastic video. Thanks! ....Being new to Rust, but not new programming languages, what I currently don't understand why "mut" is not inferred. A vast majority of the time the intent of declaring a variable is so it can be modified, otherwise use a constant. The concept of "variable" implies that it's content will vary. My intent is not to be argumentative about the finer details, I am simply trying to understand the design choice behind making variables immutable by default.
Watch some No Boilerplate's videos. ;-) - basically it makes you write safer code. And the concept. of a "variable" actually comes from maths, in maths x doesn't change, does it. A function doesn't execute steps to get to a result, ie "imperative". A function implies x. f(x), mean this implies that. I'm probably not articulating this very well.
I think you are among the greatest teachers in my list, not for programming language only, the logic the pace the delivery of your contents all 10/10. For Rust, so easy explanation with a nice content to start with. I am so motivated now to learn this language. I wish you can do other languages (e.g., Golang, Julia, C++ ), one think until today scares me is the Cmake and installing third-party libraries in C++. As for Rust language, again, thank you very much for your great video very much appreciated.
To me the biggest reason to learn Rust is Web Assembly. It is something that I see being huge in the future. However, it is also great for building systems level projects as it is not as hard as C/C++ but still very powerful.
Sat through this just to get a hunch of how to even work with rust. My first day of compiler class and they do advanced things to make a parser and test functions for it when I've never written a single line of rust. Hope this will give me an edge.
I like that those who construct languages finally understand that assuming a value are immutable are a good thing and we need to declare it specifically if not. Most values in well written code are meant to be immutable, but as for nearly all humans programmers are lazy at will not use 'cosnt' because it is not strictly neasecary to make the code run. This leads to code that are hard to fully optimize because the compiler need to use graph theory to solve dependencies of variables since we can't assume anything. On the other hand if we have that most values are immutable by default we can find which values that are not immutable and which functions has side effect by counting. Since it is harder to make a value mutable it will not happen unless we want it to, not the other way around like in js and such. Hence if the compiler can copy paste alot of function bodies instead of system calls, it can optimize much more. Mut is even good for readability and self documenting code. Since we kan deduce which values that can be changed by looking at the declaration, not try to trace usage like in js. It also makes a statement from the developer that states just touch this value, but not though. Which give you as a maintainer a easier time alter or update the code base.
@@elicoptericus Both I guess, some parts of STD are horrendous and hard to work with while others are amazing and make life much easier. Knowing which parts to use and how and which to avoid is 90% of what c++ programming is about.
Thanks Brad !! The tutorial was very helpful to jump start into rust . One suggestion at ~55:00 mins when explaining array slicing. It looks like the slice ending index is not included in the returned slice. Scratched my head a bit when I was trying it out and went to rust docs to confirm that's indeed the case. I come from C and the end index not being included wasn't very obvious to me. Might be helpful to point that out.
I believe this 2 hrs worth several rusty courses out there, hence I could not see traits included, looking forward to a 3 hrs intermediate Rust Crash from you, thank you..
This is a poorly named video. The whole point of Rust is to have sufficient memory safety that your code _doesn't_ crash. It doesn't make any sense to have a "Crash" Course when there is no crashing.
Left uncovered (yes, I know this is a crash course, it’s just a hint what to learn next): 1) how to read from stdin 2) generics 3) panic, recovering from errors 4) concurrency Now, my questions are: 1) why do we use pointer (&self) in one case and simple `self` in another when adding impl functions 2) does capturing variables in closures lead to memory leaks? Do we have to somehow annotate the capture as a weak reference?
I'm not sure about 2, but about 1 - "self" consumes the struct by effectively having the method own itself. &self only uses a reference to it, so the struct can still be used so if I call the method A(self) on B, then I can't use B anymore since it's now owned by A but if I call X(&self) on B, then I can continue using it. if I call Y(&mut self) on B, then Y can modify B since it has a mutable reference to it
@@Kajenko but why not use `&self` in `to_tuple` method then? Is it because it returns `first_name` and `last_name` strings so that the struct will not own them anymore and there's no reason to keep the struct?
Thanks Brad. Fantastic video. I am just getting started with Rust and looked at couple of videos for a quickstart. Yours is the best !! Looking forward to future videos.
Great video, thanks 👍🏻 29:55 when you got the warning about y and suggestion to call it _y it was actually because you set it and never used it, rather than set it twice. It was suggesting you use the underscore to let the compiler know it was deliberate and thus eliminate the warning.
It's a nice, easy to follow introduction to the syntax of Rust, however it doesn't help explain why anyone would want to bother with Rust, as opposed to, say, JS. If I was, for example, coming from JS or Python, without knowing C or something like that, I would probably get the impression that Rust brings nothing to the table, yet it has some weird quirks like: what's up with some functions ending with '!', or why does the string type have the '&' sign and i32 doesn't, etc. The answers to these questions are really the difference Rust makes compared to other, higher level languages. Basically, the pointer/reference section (and memory management in general) is the key to Rust. Now, I understand this is an intro, and going through the basic syntax is a good starting point, but it is important to note that it's just a start. If you've seen this video and you want to learn more, you should really look at the memory model of Rust. I would recommend the free book they have, and in particular this part: doc.rust-lang.org/stable/book/ch04-00-understanding-ownership.html
@@duke605 Like Python but with the speed of C. Here's what they say, "MIT Julia is designed to combine the speed of C with the usability of Python, the dynamism of Ruby, the mathematical prowess of MatLab, and the statistical chops of R" Check it out: julialang.org
Thanks for this. Having just discovered Rust, and being an older IT Engineer looking to break out into programming, this 'crash course' was great. If you happen to read this comment, could you, or anyone, recommend other courses for Rust.
This is an intro to the language. It is long but we go over a lot. Web Assembly with Rust is next. Also guys, check out Eduonix, they are giving my subscribers/viewers an awesome deal on courses.
TIMESTAMPS:
Intro - 1:05
Install Rust - 4:45
Creating a file - 6:26
Cargo Init & Build - 7:50
Print & Formatting - 10:42
Variables - 19:35
Data Types - 25:15
Strings - 33:42
Tuples - 44:34
Arrays - 47:14
Vectors - 55:00
Conditionals - 1:16:00
Loops - 1:07:03
Functions - 1:13:53
Pointers & Reference - 1:19:14
Structs - 1:22:00
Enums - 1:37:59
Command Line Args - 1:42:00
Please make a video on scala its brilliant programming.
Looking forward for Web Assembly.
Brad continues to be a god among boys in the coding tutorial space.
VueCLi3+TypeScript for udemy, pls!
On your way to 1.000.000 subs. Unbelievable!!!!!! Keep up your pace !!!!
Rust is NOT garbage collected! The assertion at 3:55 is false. Rust has completely deterministic memory management, enforced at COMPILE time. There is no freeing up after reaching a "threshold". This is like, one of the key things of Rust.
Yep this
Thanks for the clarification.
He said that one advantage of Rust is that it's is NOT garbage collected and then contrasts this to Javascript.
@@FreeScience But then he goes on to explain how Rust works. But what he explains is not reference counting and automatic memory management on the stack. Instead, what he explains sounds very similar to how GC works. He is basically contradicting himself, which is confusing.
Bollocks. Memory management is equivalent to the halting problem, and can't be determined before runtime.
Been using C++ for over 20 years... Rust is such a more coder-friendly language. Your videos are great, man.
C++ is so powerful but so much code to do the most simple things
@@TraversyMedia How about Julia Lang.? I heard it coming up on Rust.
The C++ of 20 years ago (C++98) is a different beast from C++17/20. They often look so different, that without knowing, they don't even seem to be the same language but rather like C and C++ when compared.
wow you can actually get a job with C++
@@shadowagent3
Like the majority of things that need performance and are not kernels, is written in C++.
Simple and straightforward, that's how teachers should have taught us.
I think Rust is a replacement for C and not C++.
At 46:00 you say that i8 goes from 0 to 255 mixing it up with u8.
Brad, I seriously think this was one of the most useful instructional videos for Rust. I am definitely looking forward to your Web Assembly tut.
Everybody take notice. THIS is what a practical video looks like. The plain stuff you will use all the time.
Meh. Rust is not that kind of "pratical" language. You need to understand it well or you're going to get frustrated at the compiler errors because you won't be able to understand them.
@@brainplot Still you need to have an entry point.
I've been wanting to learn rust for a couple of years now, but all the lack of accessible resources has turned me away ever single type up to know.
To learn means to take something you don't know, and try to make it known, and from that point on you can venture deeper.
That's especially true for programming since an inside out approach isn't really viable with the sheer amount of complexity you'd first have to master.
I agree that it is important to learn all of this, but it's easier to do it from a point of partial knowledge to be able to put into relation
@@zeberast I learned Rust from the book. I was only watching this video because I'm interested in Rust and this ended up in my recommended videos. What's wrong with the book? It seemed pretty accessible to me.
@@brainplot As someone with a severe case of ADHD books dont really do it for me.
53:10
"It's always good thing to get rid of STDs"
😂😂
I mean, that's just good life advice in general 😆
Have been thinking of that since his first mention of STD and finally..
yeah thats why lghdtv shouldn't exist
@@mokafi7 What is that
@@dimitriousdrake abone
I'm at 1:34:21 and I just want to say that you're awesome. I've had a really hard time learning Rust because the way I learn best is to learn enough not to be overwhelmed, then throw myself in the deep end.
Thank you so much.
edit: Just finished. Thanks again!
There is a mistake in description of this video. Conditionals part starts around 1:00:16 not 1:16:00.
Rushing through rust docs these days to get hands on to this new language and saw your video. Good work Brad I'm going through it right now 😂💪 #devtubers
stinky poo
You missed such a pun. NoooooooOOoOoOOOOoOOOOoooOOOOOooOOOOo.
the language is not new actually
Wow @codedamn also watching Brad UA-cam videos, that's the beauty of internet.
@@i_dont_likevodka3062 it was pretty new 5 years ago
Imagine my delight when I want to explore rust and find the guy that has continually put out fantastic content for years has a crash course on it
What I love about this channel is that here I can find the only tutorials which I can play at x1.75 just fine!
FINALLY, someone who knows how to teach this dam language. Thank you for having a good and clear tutorial for RUST I wish more people explained codes this clearly.
49:58 "it's zero indexed, like any other language" *cries in lua*
And Pascal
And R
And Visual Basic
And MATLAB
And Julia
Love Traversy's tutorials, been using them a lot lately and they're a great resource. I also love how Brad always sounds like he got into the office late and started recording it immediately.
A really great intro!
I will say the technical quality of this video is amazing. Great mic, video quality, readable font size. It sounds simple but I know it's hard to do well -- cheers!
This is a great intro, Brad! I've tried so many "intro to [language]" tutorials that are just so slow and boring, and I liked the pacing of this video. I'm excited to learn more about web assembly from you, as I'm learning what I can to be prepared for the future. It's definitely a different beast from just regular JS.
I am a bit rusty with this language, thanks Brad!
Got eeeeeeeem
Maybe this can help you: evapo-rust.com ;)
@@angelpais8160 rofl
Everyone thought it, but you had to say it...
Of all the languages I'd expect to see on your channel, I wouldn't have expected Rust!
Thank you, there are barely any resources on rust, consider doing more!
checkout 'rustup docs' in your cli ;))
The Rust Programming Language by Steve Klabnik (Author), Carol Nichols (Author)
The rust book is pretty good
Wow, i need that so much, finally someone makes a good intro to Rust. Thank you so much
As someone who programs in C++ daily for my job this just seems like better C++. Really into it. Excited for the future of this language.
Rust is better C++ and Kotlin is better Java
This is Gold.
This should be #1 to go for beginners.
I started reading the Rust book, and you nailed it.
Pure Rust demo.
Thank you.
You should change the description and replace the timestamps with this:
0:00 - Advertisement
1:05 - Intro
4:45 - Install Rust
6:26 - Creating a file
7:50 - Cargo Init & Build
10:42 - Print & Formatting
19:35 - Variables
25:15 - Data Types
33:42 - Strings
44:34 - Tuples
47:14 - Arrays
55:00 - Vectors
1:00:16 - Conditionals
1:07:03 - Loops
1:13:53 - Functions
1:19:14 - Pointers & Reference
1:22:00 - Structs
1:37:59 - Enums
1:42:00 - Command Line Args
Otherwise UA-cam won't divide your video into chapters: support.google.com/youtube/answer/9884579?hl=en
on tuples, just to be clear that max size 12 is not a limitation on tuple per-se but rather of println! macro number of arguments
Doesn't Rust support variadic macros and if so than why isen't the println! macro using it. And if not why doesn't Rust support variadics as it seems quite essential.
Nope. Tuples have a limit of 12. Atleast from my small reading of tuples docs
Apparently I was wrong. Tuples only have less functionality with size above 12.
40:20 General Kenobi!
I see you're a man of culture, as well.
I see him change it to hello there.. ctrl + f 'General' now i'm here, well done.
Brad , i'm in this industry for 12 years ... and i'm learning day by day ... i can't imagine how come do you know all this things lool .... you are like a machine bro :))
It is amazing how much traction Rust is getting. I am really looking forward to learning more about Rust.
Just a fan query?
How many technologies do you know in total? You are crazy. Thanks for inspiring millions.
Thanks :) It depends on what you mean by "know". If we are talking fundamentals and enough to create a small project, maybe 12 languages. Enough to work as a professional dev with, I would say 4 or 5. This is just actual programming languages not frameworks, libraries, standards, etc..Once you learn a couple languages, it is easy to learn more, at least on a fundamental level.
dude i was to going to ask the exact question lol.. i always tell my friends " dude there is this youtuber "traversy media" he knows mostly every frk'n language
@Manoj Sethi EVERYTHING
@@TraversyMedia you are one of the most honest developers in the world :D Any senior software developer knows that knowing a language syntax doesn't mean being able to develop software professionally in that language. Mastering a language (which means beeing able to use it professionally) requires knowing and mastering the most important language's libraries and frameworks and the tooling. In my opinion this requires at least 1 year of full professional development in that language. So, you are really really honest.
@@albertoplebani77 true that! i learned over 20 languages, where i know syntax, keywords and so on without looking up... but there are only very few languages I really mastered...
I want to give you a big thanks, Brad! This is what I needed. A very comprehensive crash course. Now I can fly through the rust docs 🤗😄
Thank you so much, Brad. Just learning from your tutorials, I become a web developer and Linux administrator. You empower me from code lover to coder.
As usual, amazing stuff Brad. You have me really thinking of whether to start with Rust or Golang. I wonder if anybody reading this would like to give their two cents on which one they like better.... Thank you Brad, and everyone, who comments.
UPDATE: Screw Go!!! I'm really diggin Rust. I one of the 5 people, who enjoyed C++, and this is very comparable, but better. Thanks again Brad for opening my eyes.
Hi Brad. I haven't seen any of your other videos. Stumbled upon this one, and it's awesome! Love how hands on it is, and how you share the code so i have plenty of snippets to refer back to and mess around with! Looking forward to similar videos covering more advanced stuff, cheers!
Maybe a short video covering ownership and pattern matching as these are significant features of rust
I’ve said it before but I have to say it again: Your brilliance is in making complex concepts stupidly simple. Thanks again!!
I appreciate this was already a lengthy video, though there were a few things I was confused about where a brief explanation of each (or why it's a longer conversation) would have been helpful:
- The difference between const and an immutable let and why you would use one over the other
- Why fn full_name has "&self" (referenced) as an argument but to_tuple has "self" (unreferenced) as an argument
- What a macro is
- Why you used .clone() in the final section
Otherwise thank you for a very useful intro video that has spurred me to look into Rust more.
Just putting a comment here because I am also interested in the answer to this question
const can only be used for constant expressions, that can be evaluated at compile time, so you can't assign a value from a function call to const variable
To be honest, you are one of the best UA-cam instructors in the game. Your Haskell video was superb and this is right up there, best in the backend UA-cam game by far!
Where is the Haskell video?
54:40 it would have been good to address the "oddity" that a slice [0..2] or [1..3] only returns two items (0 & 1 or 1 & 2 respectively)
When reading it as _"element zero _*_to_*_ two"_ then the statement is wrong. It's rather a right-open interval [ 0 ; 2 [ (indexes zero to - but not including - two).
1:12:15 the same goes for the range in a for loop - the upper bound is exclusive, hence the two examples (while vs for) are *not* doing the same thing. The former goes from 0 to 100 (including) and the latter _only_ to 99 - something also worth mentioning.
Eh that's how python does it, therefore not odd :P
I'm doing a research on different languages, this is a nice intro on Rust, saved me a lot of time, thx
Internet Without Brad Traversy Is Dead.
Haha, thanks but I think we could get by without me...I do :)
Thank you very much for this. Did the whole course and now I have enough meat on my bones to tackle something with rust.
Keep up the great work.
You're the best! Been waiting on Traversy treatment of Rust.
brad is going to set the record as a man that coded in every programming language and framework ever invented
My mind was blown at 19:23. Amazing, Rust is truly the future!
Are you convinced Rust is the future because of the default print formatting?
@@kacperfilipek8461 it was a joke, rust is nice tho
This video is precisely what I needed. Although long, it is direct and explains the basic concepts in a logical manner. Thank you very much for your effort. This old C++,C,Python, Perl, java, assembly language old dog has learned a few new tricks.
Your explanation of rust memory management is...........questionable
Your grammar is even more........questionable
You remind me of myself in a way. I struggle with a lot of the things you talk about in your other videos and feel I'm at the point you were at when you started all this. You definitely inspire me, keep up the videos, love it. I listen on my 1hr commute every day.
This is excellent content, easy to follow and exactly what I was looking for as a Java/C#/JS developer looking to get started in Rust. I really need your Rust + WebAssembly course so I'm subscribing so I see it when it lands!
Not particularly interested in Rust but I have watched it anyways, I have also worked on several of your courses and man do you deliver. Compared to other courses paid or otherwise out there, the difference is light and day. You present the material in a thoughtful and precise manner, no pauses or uhms or whatnot, you know what you want to demonstrate and proceed to do it in a calm and controlled manner. Please do a complete 70-483 course, I would gladly pay for it!
The assertions about memory management in C/C++ AND Rust that are made in the first 4 minutes or so of the video are not correct.
What is incorrect?
@@Mossmyr C/C++ and Rust share the same memory behavior. Both offer the same ability to use memory in unsafe ways, and both discourage that behavior. Rust's toolchain discourages unsafe behavior more actively whereas C/C++'s toolchains may only provide short warnings about the behavior. It's worth noting that C and C-style C++ will naturally lead to more more opportunities for errors; but it's worth remembering, it's not the language's fault when theres an error, it's the programmer's. Rust is great because it helps the programmers make fewer mistakes by default. To get the same level of support with C++, you often need additional static analyzer and warning level configuration for your compiler.
He might have confused it with the Go lang.
@@SiliconLight With C++, you also have the problem that the "best way" to program in C++ can look like alot of things are "bolted" onto the language due to legacy. This is not the fault of C++, but to wanting to stay back compatible + new insights people get. And Rust takes the fruits of those insights. C++ is hard, because you not only need to know the "good way" to program things, but also the bad ways to fully understand everything and to avoid pitfalls which the compiler doesn't complain about. Rust is just lessons learned from the past 40 years + guard rails and the way you program that is the most easy is mostly the best way to do stuff. With C++ the easiest way can be the wrong way. Also move semantics in C++.... i think those things are easier in Rust to deal with memory issues. C++ will stay here, but it has battle scars and warts that you can't remove without making people mad about not being back compatible anymore. And tell me the truth... with soon 64 and 128 cores to be normal. You want to write multi-core programs in C++ or Rust for so many cores? Rust is the only Systems language that makes you feel confident of your multi-core application.
As a Rust Noobie I have a learned a lot. A lot of things are very similar to C++ but a lot of other things are also very different. Thank you very much from 2021 :)
Wuaah that language are impressive, I've done many c++ before, and some functional languages. And I.m very familiar with syntax and logic of this paradigm. This is my next 5 year of my future 😂
I followed along with the whole thing over two evenings and it was really instructive. Thanks for sharing!
I've only heard great things about Rust: gaming, mobile, web assembly, etc. Thanks Brad for creating this crash course, I'm excited to code along.
Conditionals starts at 1:00:16. Thanks for this tutorial!!!
YES and WOW! Thank you, very excited to see your Web Assembly video. Be well
FYI, If you flip around the timestamps in the description, they'll show up as chapters! (also the first timestamp _must_ be 0:00)
e.g.
0:00 - Intro
YES, YES, YEEEEES!!! Thank you for doing this!
The STD pun was the cherry of the cake. Great tutorial.
4:12 Noone allocates memory manually in C++(using malloc or something), only in very rare special cases! C++ has classes in the stdlib which abstract all of that away. That is the greatest myth about C++, its simply not true.
Played it at 2x and still learned a lot. Thanks man
Thanks Brad, any idea if you could make a video about Rocket (web framework for Rust)?
This please. If your goal is to make a Rocket API for GETing and POSTing text, it's a breeze to use. For anything more advanced, the documentation is severely lacking. I've even reached out to Sergio Benitez himself, who was not interested in clarifying anything.
Nice, informative to-the-point Rust tutorial.
53:11 --> "Always good to get rid of the STD's" --> Enjoyed between-the-lines humor
If this is about namespaces, it is questionable advice. If about sexual transferable diseases, it is better to prevent them than to get rid of them.
Still waiting for that WebAssembly video!
Still waiting too
was able to go through the complete video , along with the programs , . It was a great video. No time wasted at all. Extremely helpful . A definite subscribe and like
I'd say that the best-known application developed by Rust is Mozilla Firefox Quantum
Quantum only has pieces that are built in rust, mainly the css engine. The browser built completely in rust is called servo. The plan is to eventually replace all of the c and c++ but it's not there yet.
And what a great endorsement of Rust. FFQ is so much faster and better than Chrome.
@@gosnooky that is part of the reason, though both browsers are getting better as far as performance is concerned.
By far the best thing about Rust is “cargo bootimage” - very easy to use Rust to develop OS kernels, although this requires the nightly instead of the stable channel and also requires the core library instead of the standard library.
Also, one needs to set up the automatic memory management in order to use it in this case - thankfully that’s rather easy thanks to Cargo and the “alloc” crate.
The os.phil-opp.com tutorial is a fantastic springboard for those who want to get to a level that low after watching this - although I haven’t seen any video equivalents to that tutorial (yet).
Thanks for sharing the OS tutorial link
Although this is a relatively good tutorial, it covers the surface level only. There is mostly summarized information about the syntax of the programming language here. This lecture goes little into how or why the language works the way it does, which I think is one of the key things to learning Rust.
I would legit pay for a C++ Crash Course from you.
Hello Brad please do a video for rocket framework for rust
Every time I want to learn something you posted about it the week before, it's amazing, keep em coming :)
Fantastic video. Thanks! ....Being new to Rust, but not new programming languages, what I currently don't understand why "mut" is not inferred. A vast majority of the time the intent of declaring a variable is so it can be modified, otherwise use a constant. The concept of "variable" implies that it's content will vary. My intent is not to be argumentative about the finer details, I am simply trying to understand the design choice behind making variables immutable by default.
Watch some No Boilerplate's videos. ;-) - basically it makes you write safer code. And the concept. of a "variable" actually comes from maths, in maths x doesn't change, does it. A function doesn't execute steps to get to a result, ie "imperative". A function implies x. f(x), mean this implies that. I'm probably not articulating this very well.
I think you are among the greatest teachers in my list, not for programming language only, the logic the pace the delivery of your contents all 10/10. For Rust, so easy explanation with a nice content to start with. I am so motivated now to learn this language. I wish you can do other languages (e.g., Golang, Julia, C++ ), one think until today scares me is the Cmake and installing third-party libraries in C++.
As for Rust language, again, thank you very much for your great video very much appreciated.
Brad, in which situations would it make sense to use rust over something else?
To me the biggest reason to learn Rust is Web Assembly. It is something that I see being huge in the future. However, it is also great for building systems level projects as it is not as hard as C/C++ but still very powerful.
Probably the best Rust crash course video out there! More RustLang vids please. Awesome and more power to the channel!
I can appreciate some more subtle jokes like the ones at 53:11 haha
Sat through this just to get a hunch of how to even work with rust. My first day of compiler class and they do advanced things to make a parser and test functions for it when I've never written a single line of rust. Hope this will give me an edge.
Ooooh, compiler class :)
Good luck!
@@kiraPh1234k Thanks! After yesterdays class I can say that I really need it. :)
For those who want to get into parsers, check out nom for rust.
Hi Brad, Could you please make a course of Web API with RUST and MYSQL? i will appreciate it.
I like that those who construct languages finally understand that assuming a value are immutable are a good thing and we need to declare it specifically if not. Most values in well written code are meant to be immutable, but as for nearly all humans programmers are lazy at will not use 'cosnt' because it is not strictly neasecary to make the code run.
This leads to code that are hard to fully optimize because the compiler need to use graph theory to solve dependencies of variables since we can't assume anything. On the other hand if we have that most values are immutable by default we can find which values that are not immutable and which functions has side effect by counting. Since it is harder to make a value mutable it will not happen unless we want it to, not the other way around like in js and such. Hence if the compiler can copy paste alot of function bodies instead of system calls, it can optimize much more.
Mut is even good for readability and self documenting code. Since we kan deduce which values that can be changed by looking at the declaration, not try to trace usage like in js. It also makes a statement from the developer that states just touch this value, but not though. Which give you as a maintainer a easier time alter or update the code base.
Hahaha... getting rid of STD's... 😂
I had to say it lol
Using std::whatuwant;
everytime
C++ developers all over the world right now don't know if they should be angry or laugh
@@elicoptericus Both I guess, some parts of STD are horrendous and hard to work with while others are amazing and make life much easier. Knowing which parts to use and how and which to avoid is 90% of what c++ programming is about.
Thanks Brad !! The tutorial was very helpful to jump start into rust . One suggestion at ~55:00 mins when explaining array slicing. It looks like the slice ending index is not included in the returned slice. Scratched my head a bit when I was trying it out and went to rust docs to confirm that's indeed the case. I come from C and the end index not being included wasn't very obvious to me. Might be helpful to point that out.
tthe start index can also not be present and itll assume 0
Brad Traversy > IBM Watson
What does that even mean?
Lord Swaggity artificial intelligence machine of IBM
I believe this 2 hrs worth several rusty courses out there, hence I could not see traits included, looking forward to a 3 hrs intermediate Rust Crash from you, thank you..
Full course on Udemy? 😁
awesome video! loved the pacing, the explanations, everything!
Brad: Lets do push_str(" world")
Me: push_str("😩✋💯")
uploaded 4 years ago but I just seeing this know, because I want to learn new language😁 Thanks Brad
This is a poorly named video. The whole point of Rust is to have sufficient memory safety that your code _doesn't_ crash. It doesn't make any sense to have a "Crash" Course when there is no crashing.
lol i'm not sure you're being serious or sarcastic :D
I approve this joke.
Well done
@@devviz the joke is clear as day
Beautiful
This is a great place to start. Well spoken, easy to follow and your Bostonion? accent makes it more interesting.. thanks
Traits..?
dude you're insane, is it too much to ask for modern c++ crash course? haha thanks for the content brad!
Rust is such a weird language.
I hate the syntax.
I hate the way how it handles stuff.
I hate the packaging system.
But that's why i want to learn it.
Left uncovered (yes, I know this is a crash course, it’s just a hint what to learn next):
1) how to read from stdin
2) generics
3) panic, recovering from errors
4) concurrency
Now, my questions are:
1) why do we use pointer (&self) in one case and simple `self` in another when adding impl functions
2) does capturing variables in closures lead to memory leaks? Do we have to somehow annotate the capture as a weak reference?
I'm not sure about 2, but about 1 - "self" consumes the struct by effectively having the method own itself. &self only uses a reference to it, so the struct can still be used
so if I call the method A(self) on B, then I can't use B anymore since it's now owned by A
but if I call X(&self) on B, then I can continue using it.
if I call Y(&mut self) on B, then Y can modify B since it has a mutable reference to it
@@Kajenko but why not use `&self` in `to_tuple` method then? Is it because it returns `first_name` and `last_name` strings so that the struct will not own them anymore and there's no reason to keep the struct?
In the description conditionals are Conditionals - 1:16:00 when it needs to be Conditionals - 1:00:00
Thanks Brad. Fantastic video.
I am just getting started with Rust and looked at couple of videos for a quickstart.
Yours is the best !!
Looking forward to future videos.
Great video, thanks 👍🏻
29:55 when you got the warning about y and suggestion to call it _y it was actually because you set it and never used it, rather than set it twice. It was suggesting you use the underscore to let the compiler know it was deliberate and thus eliminate the warning.
It's a nice, easy to follow introduction to the syntax of Rust, however it doesn't help explain why anyone would want to bother with Rust, as opposed to, say, JS. If I was, for example, coming from JS or Python, without knowing C or something like that, I would probably get the impression that Rust brings nothing to the table, yet it has some weird quirks like: what's up with some functions ending with '!', or why does the string type have the '&' sign and i32 doesn't, etc. The answers to these questions are really the difference Rust makes compared to other, higher level languages. Basically, the pointer/reference section (and memory management in general) is the key to Rust.
Now, I understand this is an intro, and going through the basic syntax is a good starting point, but it is important to note that it's just a start. If you've seen this video and you want to learn more, you should really look at the memory model of Rust. I would recommend the free book they have, and in particular this part: doc.rust-lang.org/stable/book/ch04-00-understanding-ownership.html
Man... having a background with Golang, Ruby, Python, and C#/Java, this language is all of them combined
That's what they say about Julia Lang.
AdamsTaiwan never even heard of it
@@duke605 Like Python but with the speed of C. Here's what they say, "MIT Julia is designed to combine the speed of C with the usability of Python, the dynamism of Ruby, the mathematical prowess of MatLab, and the statistical chops of R" Check it out: julialang.org
Thanks for this. Having just discovered Rust, and being an older IT Engineer looking to break out into programming, this 'crash course' was great. If you happen to read this comment, could you, or anyone, recommend other courses for Rust.