Rust Crash Course | Rustlang
Ғылым және технология
Learn all the fundamentals of the Rust programming language in this crash course.
Sponsor: Eduonix
bit.ly/traversymedia
Code:
github.com/bradtraversy/rust_...
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
💖 Become a Patron: Show support & get perks!
/ traversymedia
Website & Udemy Courses
www.traversymedia.com
Follow Traversy Media:
/ traversymedia
/ traversymedia
/ traversymedia
Пікірлер: 1 000
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
@kaustubhken
5 жыл бұрын
Please make a video on scala its brilliant programming.
@sarangs8441
5 жыл бұрын
Looking forward for Web Assembly.
@AudioBassetHound
5 жыл бұрын
Brad continues to be a god among boys in the coding tutorial space.
@haiyangwu1327
5 жыл бұрын
VueCLi3+TypeScript for udemy, pls!
@marciomafideju1775
5 жыл бұрын
On your way to 1.000.000 subs. Unbelievable!!!!!! Keep up your pace !!!!
Been using C++ for over 20 years... Rust is such a more coder-friendly language. Your videos are great, man.
@TraversyMedia
5 жыл бұрын
C++ is so powerful but so much code to do the most simple things
@AdamsTaiwan
5 жыл бұрын
@@TraversyMedia How about Julia Lang.? I heard it coming up on Rust.
@DarkLevis
5 жыл бұрын
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.
@shadowagent3
5 жыл бұрын
wow you can actually get a job with C++
@obinator9065
4 жыл бұрын
@@shadowagent3 Like the majority of things that need performance and are not kernels, is written in C++.
53:10 "It's always good thing to get rid of STDs" 😂😂
@joakker8820
3 жыл бұрын
I mean, that's just good life advice in general 😆
@cl3761
2 жыл бұрын
Have been thinking of that since his first mention of STD and finally..
@mokafi7
2 жыл бұрын
yeah thats why lghdtv shouldn't exist
@dimitriousdrake
2 жыл бұрын
@@mokafi7 What is that
@asprithe1607
2 жыл бұрын
@@dimitriousdrake abone
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.
@jamesnewman9547
5 жыл бұрын
Yep this
@GRAYgauss
5 жыл бұрын
Thanks for the clarification.
@FreeScience
5 жыл бұрын
He said that one advantage of Rust is that it's is NOT garbage collected and then contrasts this to Javascript.
@ole4707
5 жыл бұрын
@@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.
@no-defun-allowed
5 жыл бұрын
Bollocks. Memory management is equivalent to the halting problem, and can't be determined before runtime.
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.
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.
49:58 "it's zero indexed, like any other language" *cries in lua*
@valdisxp1
3 жыл бұрын
And Pascal
@neelanjanmanna6292
3 жыл бұрын
And R
@useruserov8668
3 жыл бұрын
And Visual Basic
@raderh2o
3 жыл бұрын
And MATLAB
@felineboy
3 жыл бұрын
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!
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
@basedfacistman
3 жыл бұрын
stinky poo
@shambhav9534
2 жыл бұрын
You missed such a pun. NoooooooOOoOoOOOOoOOOOoooOOOOOooOOOOo.
@i_dont_likevodka3062
2 жыл бұрын
the language is not new actually
@thehimalyanexplorer
Жыл бұрын
Wow @codedamn also watching Brad KZread videos, that's the beauty of internet.
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!
Wow, i need that so much, finally someone makes a good intro to Rust. Thank you so much
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.
Of all the languages I'd expect to see on your channel, I wouldn't have expected Rust!
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 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.
You're the best! Been waiting on Traversy treatment of Rust.
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!
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.
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.
What I love about this channel is that here I can find the only tutorials which I can play at x1.75 just fine!
It is amazing how much traction Rust is getting. I am really looking forward to learning more about Rust.
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.
Every time I want to learn something you posted about it the week before, it's amazing, keep em coming :)
YES and WOW! Thank you, very excited to see your Web Assembly video. Be well
Everybody take notice. THIS is what a practical video looks like. The plain stuff you will use all the time.
@brainplot
3 жыл бұрын
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.
@zeberast
3 жыл бұрын
@@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
@brainplot
3 жыл бұрын
@@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.
@__________________________4597
3 жыл бұрын
@@brainplot As someone with a severe case of ADHD books dont really do it for me.
I followed along with the whole thing over two evenings and it was really instructive. Thanks for sharing!
Loved it. Thanks for uploading. I was looking for a video which shows almost all the basics and I believe this covers all basic stuff about rust.
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!
At 46:00 you say that i8 goes from 0 to 255 mixing it up with u8.
Thank you for making this course! Really enjoyed and appreciated it!
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
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.
YES, YES, YEEEEES!!! Thank you for doing this!
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.
Wow this is so good! Tempo is just perfect, love it! Thank you.
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.
awesome video! loved the pacing, the explanations, everything!
Thanks so much! I followed along the whole time and this was a nice start to learning the syntax and understanding the code. I am learning Rust for programming Solana blockchain smart contracts.
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 😂
Thank you, there are barely any resources on rust, consider doing more!
@aquaductape
5 жыл бұрын
checkout 'rustup docs' in your cli ;))
@hammerheadcorvette4
4 жыл бұрын
The Rust Programming Language by Steve Klabnik (Author), Carol Nichols (Author)
@martinlord5969
3 жыл бұрын
The rust book is pretty good
Really good and useful content that while being long still keeps the audience paying attention! Nice job!
Dude. Yes. I've been meaning to pick up rust and I have a few projects ideas to get going. This is awesome.
Maybe a short video covering ownership and pattern matching as these are significant features of rust
There is a mistake in description of this video. Conditionals part starts around 1:00:16 not 1:16:00.
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.
Probably the best Rust crash course video out there! More RustLang vids please. Awesome and more power to the channel!
I am a bit rusty with this language, thanks Brad!
@akshith2985
5 жыл бұрын
Got eeeeeeeem
@angelpais8160
5 жыл бұрын
Maybe this can help you: evapo-rust.com ;)
@cdfn1323
5 жыл бұрын
@@angelpais8160 rofl
@maximalgamingnl9954
4 жыл бұрын
Everyone thought it, but you had to say it...
40:20 General Kenobi!
@OlavLadnav
4 жыл бұрын
I see you're a man of culture, as well.
@bobboris9673
3 жыл бұрын
I see him change it to hello there.. ctrl + f 'General' now i'm here, well done.
I'm doing a research on different languages, this is a nice intro on Rust, saved me a lot of time, thx
Completed! I have learnt so many things Brad! Thanks a lot.
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.
@Messmerd97
Жыл бұрын
Just putting a comment here because I am also interested in the answer to this question
@kacperfilipek8461
Жыл бұрын
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
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
@DantalionNl
4 жыл бұрын
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.
@github1357
4 жыл бұрын
Nope. Tuples have a limit of 12. Atleast from my small reading of tuples docs
@github1357
4 жыл бұрын
Apparently I was wrong. Tuples only have less functionality with size above 12.
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! Very helpful and easy to understand. Followed this with coding it myself and it gave me a good introduction into Rust!
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 KZread won't divide your video into chapters: support.google.com/youtube/answer/9884579?hl=en
Just a fan query? How many technologies do you know in total? You are crazy. Thanks for inspiring millions.
@TraversyMedia
5 жыл бұрын
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.
@AryanGupta-tx6vt
5 жыл бұрын
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
@Ash-em5pm
5 жыл бұрын
@Manoj Sethi EVERYTHING
@albertoplebani77
5 жыл бұрын
@@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.
@ZapOKill
5 жыл бұрын
@@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...
God bless you @brad. I've been looking for something like this.
Thanks Brad. Awesome introduction. Really enjoyed working through.
Internet Without Brad Traversy Is Dead.
@TraversyMedia
5 жыл бұрын
Haha, thanks but I think we could get by without me...I do :)
Thanks Brad, any idea if you could make a video about Rocket (web framework for Rust)?
@INT_MAX
5 жыл бұрын
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.
Waiting for the webassembly course ! Thanks for the great tutorial !
Awesome tutorial!! This is the best tutorial I've ever run across. Congratulations.
Your explanation of rust memory management is...........questionable
@newborn7348
2 жыл бұрын
Your grammar is even more........questionable
My mind was blown at 19:23. Amazing, Rust is truly the future!
@kacperfilipek8461
2 жыл бұрын
Are you convinced Rust is the future because of the default print formatting?
@jajaperson
2 жыл бұрын
@@kacperfilipek8461 it was a joke, rust is nice tho
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!
I’ve said it before but I have to say it again: Your brilliance is in making complex concepts stupidly simple. Thanks again!!
Hi Brad, Could you please make a course of Web API with RUST and MYSQL? i will appreciate it.
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.
@GlobusTheGreat
Жыл бұрын
Eh that's how python does it, therefore not odd :P
Great video! Just completed this, and came out with a much better understanding of Rust!
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
Hello Brad please do a video for rocket framework for rust
Still waiting for that WebAssembly video!
@Shaparder
2 жыл бұрын
Still waiting too
Thank you !!! Your video ist great. This is the best programming tutorial I have ever seen. Short and to the point. 👍🏻
Great video, thanks a lot. Eagerly waiting for your videos on Rust projects you mentioned (which you are planning) in the video.
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.
@Mossmyr
3 жыл бұрын
What is incorrect?
@LamboPita
3 жыл бұрын
@@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.
@thepedzed
3 жыл бұрын
He might have confused it with the Go lang.
@HermanWillems
3 жыл бұрын
@@LamboPita 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.
I can appreciate some more subtle jokes like the ones at 53:11 haha
Much thanks, Brad Traversy 😉 I'm much more confident at going though the docs and specs.
Yo, I had to comment, this was awesome and the only video that truly covered a lot of the aspects, thanks for the long video you covered a lot!
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.
@RoastLambShanks
Жыл бұрын
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.
Brad, in which situations would it make sense to use rust over something else?
@TraversyMedia
5 жыл бұрын
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.
great tutorial Brad. Thank you. Looking forward to any others you put together.
big thanks for this, best rust tutorial i've come across thus far
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'd say that the best-known application developed by Rust is Mozilla Firefox Quantum
@draakisback
5 жыл бұрын
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.
@gosnooky
5 жыл бұрын
And what a great endorsement of Rust. FFQ is so much faster and better than Chrome.
@draakisback
5 жыл бұрын
@@gosnooky that is part of the reason, though both browsers are getting better as far as performance is concerned.
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.
Thanks Brad! Ironically I just installed emscripten and rustup. I too want to start to learn wasm. This is perfect to intro me to the rust side. Great timing bro. Cheers!
@ohmree
5 жыл бұрын
Is there a use for emscripten when Rust can produce wasm directly?
Brad: Lets do push_str(" world") Me: push_str("😩✋💯")
Hahaha... getting rid of STD's... 😂
@TraversyMedia
5 жыл бұрын
I had to say it lol
@1_nS1d3
5 жыл бұрын
Using std::whatuwant;
@skimtiazahmed7415
4 жыл бұрын
everytime
@elicoptericus
4 жыл бұрын
C++ developers all over the world right now don't know if they should be angry or laugh
@DantalionNl
4 жыл бұрын
@@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.
Hi man! your videos covering the crash courses are helping me a lot . Thank you :*
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 :)
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.
Traits..?
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.
Thank you Brad! You're the best! Keep it coming :)
Full course on Udemy? 😁
Brad Traversy > IBM Watson
@lordswaggity1213
5 жыл бұрын
What does that even mean?
@chrisplusplus6232
5 жыл бұрын
Lord Swaggity artificial intelligence machine of IBM
Nice and concise, covering the Rust basics well. Thanks!
Now this is golden, well done Travis!