A Tour of Rust

Ғылым және технология

In today's video, we are going through the features which make the Rust programming language unique!
Chapters:
0:00 Intro
0:23 Performance
0:52 Memory Safety
4:11 The Powerful Type System
11:07 Polymorphism With Traits & Generics
14:13 Extensibility With Macros
15:27 Building & Package Management
#rust #programming #tutorial

Пікірлер: 121

  • @letsgetrusty
    @letsgetrusty2 жыл бұрын

    📝Get your *FREE Rust cheat sheet* : www.letsgetrusty.com/cheatsheet

  • @EvanBoldt
    @EvanBoldt2 жыл бұрын

    I tried a small project in Rust recently. Usually differences between languages seem very small enough you could almost forget the language, but Rust needs you to understand some significant concepts first. It took a bit to learn, but I did experience the phenomenon of the code working the first time once actually compiled.

  • @AmirHosseinHonardust

    @AmirHosseinHonardust

    2 жыл бұрын

    Did what you have learned about rust, improve your ability to program in other languages as well? For example many claim that learning haskell can help you program better in other languages as well. I wonder if it's the same in rust.

  • @mrwaltlearning9675

    @mrwaltlearning9675

    2 жыл бұрын

    @@AmirHosseinHonardust It's more like learning functional programming makes you a better programmer than learning a specific functional language.

  • @dealloc

    @dealloc

    2 жыл бұрын

    @@AmirHosseinHonardust Yes, but also surfaces what those languages are missing in terms of ergonomics. Pattern matching, traits, parameterized enum and zero-cost iters are just some of the features I wish was the norm in other languages.

  • @sobanya_228

    @sobanya_228

    2 жыл бұрын

    @@AmirHosseinHonardust Fun fact, Rust actually came from functional languages OCaml and Haskell with the addition of low-level features and more mainstream syntax.

  • @AmirHosseinHonardust

    @AmirHosseinHonardust

    2 жыл бұрын

    @@sobanya_228 oh! I did not know that! Thanks!

  • @mrbrownfr
    @mrbrownfr2 жыл бұрын

    Weirdly looks like a No Boilerplate video

  • @tobecontinued5757

    @tobecontinued5757

    2 жыл бұрын

    Ngl I thought it was one

  • @bigtymer4862

    @bigtymer4862

    2 жыл бұрын

    That’s fine by me 😅

  • @ttj_

    @ttj_

    2 жыл бұрын

    @@bigtymer4862 same lol, the more like NBP the better

  • @eadweard.

    @eadweard.

    2 жыл бұрын

    I clicked and thought "Oh he's got the other guy to do a guest spot?"

  • @jojowolf6826

    @jojowolf6826

    Жыл бұрын

    true

  • @MrKaueschultz
    @MrKaueschultz2 жыл бұрын

    A gem in video format. Keep up the great work

  • @leo848
    @leo8482 жыл бұрын

    2:38 it is actually considered more idiomatic to call this via Rc::clone(ben) to distinguish it from the expensive cloning of other objects. 5:46 here you could just write Some(user) instead of return Some(user); (as you did in the None case) 9:33 this would be a good usecase for the filter_map method, you could just replace map with filter_map and remove the call to flatten

  • @dluxdoggdlux

    @dluxdoggdlux

    2 жыл бұрын

    Hey Bogdan! Excellent video - Leo makes some fine suggestions. I'll just add --- you can use split_once()! :) Ref: doc.rust-lang.org/std/string/struct.String.html#method.split_once

  • @leo848

    @leo848

    2 жыл бұрын

    @@dluxdoggdlux Nice, didn't know about that one.

  • @letsgetrusty

    @letsgetrusty

    2 жыл бұрын

    Thanks for pointing these out for folks!

  • @AndrewBrownK

    @AndrewBrownK

    Жыл бұрын

    I love me some filter_map

  • @MrJester831

    @MrJester831

    Жыл бұрын

    He can also use the ? operator to shortcut this. check_user(id)?; Some(user_for_id(id)?)

  • @eduardabramovich1216
    @eduardabramovich1216 Жыл бұрын

    It would be awesome if you created a series of project-based tutorials. One thing i'd like to learn the most is network programming with rust, i see there is a book but there is almost zero content on youtube for this.

  • @JasonBristol
    @JasonBristol2 жыл бұрын

    I love this video, thank you for making it. Have enjoyed the foray into rust thoroughly, and this video helped break down what I was seeing. Definitely some paradigm shifts, but some of these are absolutely elegant and intuitive once you know they are there Especially like the absence of null, private by default, and zero cost abstractions

  • @nicholasbicholas
    @nicholasbicholas2 жыл бұрын

    Awesome introductory video!

  • @joelmontesdeoca6572
    @joelmontesdeoca65722 жыл бұрын

    LOL I thought I was going to watch a new No Boilerplate video. You got me! xD

  • @bjugdbjk
    @bjugdbjk Жыл бұрын

    Just love the way, u explained the concepts with other language snippets !! that really helps to understand the craziness of rust brings on the table !! Awesome man !!

  • @logeshkumarrajkumar861
    @logeshkumarrajkumar8612 жыл бұрын

    First comment. Love ur videos. I am a frontend developer started learning Rust

  • @xorlop
    @xorlop2 жыл бұрын

    Wow, thank you so much for this video.. I really feel like I can now understand traits and generics in Rust, something that always was daunting for me. This was a really cool video!

  • @johnnyelcoste
    @johnnyelcoste2 жыл бұрын

    this is the first video that really shows the power of Rust and I am totally hooked to learn more about it. thank you very much for the creation of the video.you have changed to a Developer

  • @boyanbalev4428
    @boyanbalev44282 жыл бұрын

    Thank you,Bogdan!

  • @vibecoderdev
    @vibecoderdev2 жыл бұрын

    Amazing video. Very detailed, insightful and helpful.

  • @liminal6823
    @liminal6823 Жыл бұрын

    Completely new to this language -- this tutorial is unrelentingly lucid and hits all my initial questions -- thx

  • @theherk
    @theherk2 жыл бұрын

    This is one of your best videos. Really nice work. This should be a go to video for those interested in becoming Rustaceans.

  • @patrikpyrzanowski5440
    @patrikpyrzanowski54402 жыл бұрын

    This video convinced me to go with Rust rather than GoLang. Feels like Typescript on steroids. This is a more in depth introduction with very clear examples and good comparisons. Thank you for this content.

  • @ioneocla6577

    @ioneocla6577

    2 жыл бұрын

    They both have their pros and cons. I would use go for higher level stuff that still needs to be fast

  • @bjugdbjk

    @bjugdbjk

    Жыл бұрын

    I guess Go is right fit only for Microservices at the server side !! rest is Rust can do far better. Maintaining the dependencies in big Go projects is beautiful Nightmare.

  • @Ian-eb2io

    @Ian-eb2io

    Жыл бұрын

    I liked Go initially, but it soon started feeling like the language was designed by a bunch of drunks on the tail end of a bender. That's because it was slapped together and each release is an attempt to further patch over very bad underlying choices. Which is a pity because it could have been a brilliant language that is easy to learn.

  • @snansahmarov1524
    @snansahmarov15242 жыл бұрын

    Great video!

  • @swanandx
    @swanandx2 жыл бұрын

    Blazingly fast tour

  • @lagcisco
    @lagcisco Жыл бұрын

    thanks for this fantastic tour

  • @lukkklukk7045
    @lukkklukk70452 жыл бұрын

    Cool video. Keep on doing them. Moving from a FE and some of BE background. I find Rust as a great and robust language to write in.

  • @0xccd
    @0xccd2 жыл бұрын

    Nice summary!

  • @mardix
    @mardix2 жыл бұрын

    Wow. Thank you very much. Your channel is what put me on Rust.

  • @younglion0451
    @younglion04512 жыл бұрын

    Thank you so much for this!

  • @MrSabotax
    @MrSabotax2 жыл бұрын

    great video to convert more people to Rustaceans, thanks!

  • @devchaudhary78
    @devchaudhary782 жыл бұрын

    Rust is amazing🔥🔥

  • @chillyvanilly6352
    @chillyvanilly63522 жыл бұрын

    all in all amazing vid!

  • @okanyldrmop
    @okanyldrmop2 жыл бұрын

    I was planning to learn Rust but I was afraid whether it is too hard for me or not. After this video, I understand many things. Thank you!

  • @TJ-wc3iq
    @TJ-wc3iq2 жыл бұрын

    That is simply brilliant! 🙌🏻 Look forward to Wallace's response. 😅 By the way, who is "the student Kyle" who made the highest point? 🤓

  • @GlobalYoung7
    @GlobalYoung72 жыл бұрын

    thank you 😊

  • @sabuein
    @sabuein2 жыл бұрын

    Thank you.

  • @dmitriidemenev5258
    @dmitriidemenev52582 жыл бұрын

    9:30 I believe you should have used `filter_map()` instead. cargo clippy would likely make that suggestion for you

  • @uwuzote
    @uwuzote2 жыл бұрын

    Nice, high quality as always! (sorry for bad english)

  • @gamer-gw9iy

    @gamer-gw9iy

    2 жыл бұрын

    Good English

  • @uwuzote

    @uwuzote

    2 жыл бұрын

    @@gamer-gw9iy i cannot be sure, so i put it always

  • @gamer-gw9iy

    @gamer-gw9iy

    2 жыл бұрын

    @@uwuzote always put it

  • @31redorange08

    @31redorange08

    2 жыл бұрын

    I'm offended by your low level of English.

  • @affifhartono5410
    @affifhartono54102 жыл бұрын

    you are not like the others who puts link filled with adds, so u deserve to be subscribed..... thanks for the plugin and all the best for future

  • @eprohoda
    @eprohoda2 жыл бұрын

    hoow’s everything going?- Love it, that is gorgeous !have a good day-

  • @ZReChannel
    @ZReChannel2 жыл бұрын

    _nice_

  • @erlangparasu6339
    @erlangparasu63392 жыл бұрын

    "clearly indicate" is the best statements

  • @opethian2k2
    @opethian2k22 жыл бұрын

    Got any experience with building desktop apps with Rust? What would you choose for Linux? GTK+ or something else?

  • @kamranmoazzamansari7289
    @kamranmoazzamansari7289 Жыл бұрын

    what's the debugging tool, it's awesome

  • @Tantandev
    @Tantandev2 жыл бұрын

    Awesome examples! I think however the inline type hints is a bit distracting in understanding the code. Especially looking at 9:30

  • @leo848

    @leo848

    2 жыл бұрын

    That's true, I don't like using IDEs to display code either. But in this case I would even find it distracting during development.

  • @letsgetrusty

    @letsgetrusty

    2 жыл бұрын

    Yeah I see your point. Thanks for the feedback Tantan!

  • @CC-bl7yf
    @CC-bl7yf2 жыл бұрын

    Really tho, I come from Mobile development with Kotlin and now am learning Rust from your channel. Can you recommend me any industry to shine with rust probably in future?

  • @DavidAlsh
    @DavidAlsh Жыл бұрын

    What does "ben".to_owned() do and why use it over "ben".to_string() or String::from("ben")?

  • @lodoss118
    @lodoss1182 жыл бұрын

    Question in rust is there a concept of a deconstructor, if i have list of objects in memory when do a free these items, when out of scope does this memory get released

  • @KohuGaly

    @KohuGaly

    2 жыл бұрын

    Yes. In rust deconstructions are automatically generated by the compiler. You can implement Drop trait for your struct, so it runs custom code in the deconstructor. Most datastructures in Rust have these custom Drop codes, to clean up after themselves (especially if they internally manually manage some resource).

  • @m.sierra5258

    @m.sierra5258

    2 жыл бұрын

    I would actually add that Rust deconstructors are one of the most reliable ones that exist. Due to the fact that Rust is not garbage collected and has a strong concept of ownership and the borrow checker, it's really reliable that deconstructors get called exactly once at exactly the time where the object goes out of scope. Missing free or double free problems virtually don't exist, and due to the fact that there are no implicit copies by default and everything gets moved instead, you can be sure that if you create one object and handle it in various ways, there will also be exactly one drop called.

  • @Malt1193
    @Malt11932 жыл бұрын

    At 6:10 there is a comma seperating Some and None, but at 7:27 there is no comma seperating OK and Err, is the comma optional, just a comma operator making it seem like a list of things, or an error?

  • @Starwort

    @Starwort

    2 жыл бұрын

    Inside a match statement, commas are required, unless the arm's value is calculated from a block. (If the arm's value _is_ calculated from a block, rustfmt will remove the commas by default)

  • @autogenes
    @autogenes2 жыл бұрын

    10:21 is the reference to self in the fn execute signature arbitrary? seems kind of unnecessary for the example

  • @autogenes

    @autogenes

    2 жыл бұрын

    awesome video btw^^

  • @mesutdogansoy

    @mesutdogansoy

    2 жыл бұрын

    self represents the current instance

  • @dmitriidemenev5258

    @dmitriidemenev5258

    2 жыл бұрын

    Reference to self can demonstrate the way you pass the value. self: You're responsible for the cleanup. &self: you can only read this, &mut self: you can also change this.

  • @alankjohn9263
    @alankjohn92632 жыл бұрын

    can we get a comparison with zig?

  • @finnmonstar

    @finnmonstar

    2 жыл бұрын

    I feel like Zig "borrowed" a lot of stuff from Rust. Inferior language overall, but yeah :)

  • @dmitriidemenev5258

    @dmitriidemenev5258

    2 жыл бұрын

    @@finnmonstar Zig's type level programming seems to be nice. Rust's procedural macros compensate for some cases but sometimes Rust is lacking expressivity.

  • @geeksesi
    @geeksesi2 жыл бұрын

    amazing. could you explain

  • @milespiano

    @milespiano

    2 жыл бұрын

    it's a lifetime annotation, which he didn't explain in the video. it's for references because the compiler doesn't understand how to tell how long their "king" lives until runtime

  • @leo848

    @leo848

    2 жыл бұрын

    You should maybe read the book chapter about lifetimes.

  • @31redorange08

    @31redorange08

    2 жыл бұрын

    No one truly understands. Just add it when the computer tells you to and hope for the best.

  • @geeksesi

    @geeksesi

    2 жыл бұрын

    @@31redorange08 😂😂

  • @zeit1904
    @zeit19042 жыл бұрын

    1:09 isnt this like unique_ptr in c++?

  • @KohuGaly

    @KohuGaly

    2 жыл бұрын

    Yes, unique_ptr in C++ is a smart pointer that enforces single ownership. Rust also has such smart pointer, called Box. The difference from C++ is that in Rust, by default, everything behaves like unique_ptr, including stuff on the stack. You need special containers to opt out of it (such as the equivalents of shared_ptr in C++). The compile-time-checked memory safety of Rust comes from Rust sticking to the ownership rules "religiously" and having them enforced by the compiler.

  • @dynfoxx

    @dynfoxx

    2 жыл бұрын

    @@KohuGaly I believe Rust box also optomizes better then C++ unique pointer due to layout and calling convention. Also Rust a niche for box which remove null checks but allow for no additional size to option which i think is really cool.

  • @eineatombombe
    @eineatombombe2 жыл бұрын

    Ben got dropped, RIP ben

  • @astronemir
    @astronemir Жыл бұрын

    Private by default is the worst part. Every library developer thinks they know best but I could re-use their code like in python if I could just change one or two small things about it. Well I don’t want to maintain forks of 3rd party packages just to use it so the python way just works so much better for me. Really frustrated by the private by default

  • @shivrajnag12
    @shivrajnag12 Жыл бұрын

    The concepts shown in this 16 min video might take 16 months to master.

  • @ultrathinnmemes5951
    @ultrathinnmemes5951 Жыл бұрын

    10 seconds in and I don't think he's about to introduce me to the game called RUST...

  • @ketchup901
    @ketchup901 Жыл бұрын

    6:54 "One reason this style of error handling is problematic is that the caller of this function has no idea an exception could be thrown by looking at the function signature" Wrong. In Java, which is what you're imitating, you would put "throws ValidationException" in the function header. You can then handle it programmatically with a try-catch-finally statement. I see no big difference between Java exceptions and Rust errors.

  • @ChamplooMusashi
    @ChamplooMusashi Жыл бұрын

    I like Rust but not learning it. Most of the resources to learn seem to be caught within a vaccuum, that is that they assume some knowledge of rust and fail to provide a constructive network of lessons or projects that jump from one to the next sufficiently. These significant assumptions make it difficult to fully grasp one concept before moving onto the next. I don't need to understand something, but I find it very frustrating when precise details are left out of documentation. Often times there will be some mundane, trivial examples of a concept followed by a single not well-explained example. Contrast that with something like JS where you can learn the entirety of it by simply visiting MDN with simple, intermediate, and complicated examples. While I can certainly appreciate the features Rust offers and what lessons are there, I find the lack of this to be a core lacking feature of the Rust ecosystem. I hope to learn it, but I don't see that happening anytime soon with the demands of life and the demands of the language upon the programmer.

  • @robbietorkelsonn8509
    @robbietorkelsonn8509 Жыл бұрын

    microsoft: create a language that is as unlike C++ and java as possible Anders Hejlsberg: inventor of the null reference Then fud on C++ for you know ... not having any syntax with which to even create a null reference

  • @lukaszkowalski-198
    @lukaszkowalski-1982 жыл бұрын

    In any other language it can be done more simply. I prefer C# to Rust!!!

  • @ctrlcapsswap966

    @ctrlcapsswap966

    Жыл бұрын

    why not python then? one of the simplest languages

  • @cvspvr

    @cvspvr

    Жыл бұрын

    @@ctrlcapsswap966 nah man, i'm all about programming in scratch

  • @ctrlcapsswap966

    @ctrlcapsswap966

    Жыл бұрын

    @@cvspvr but python is from scratch lmao. you should stop getting all your info from you tubers who never worked as programmers, dude. it's bad for you

  • @cvspvr

    @cvspvr

    Жыл бұрын

    @@ctrlcapsswap966 i meant scratch as in the drag and drop programming language for kids

  • @ctrlcapsswap966

    @ctrlcapsswap966

    Жыл бұрын

    @@cvspvr well... that's not that different from python either

  • @Kaizala1933
    @Kaizala19332 жыл бұрын

    Wait, how is None not equivalent to Null?

  • @tjgdddfcn

    @tjgdddfcn

    2 жыл бұрын

    None is not a type but a variation of the Option enum Option has two possible variants Some(T) and None. For a function to return None it needs to specify that it returns an Option. You can’t use Option like a normal variable but need to use a match statement to handle cases whether the option is Some(T) or None. Or call .unwrap() on it to turn the option into the value within Some(T) or crash if the value is None

  • @KohuGaly

    @KohuGaly

    2 жыл бұрын

    The difference from regular Null, is that Option cannot be used directly as if it were the value - you need to match on it, to either extract the inner value (the Some(v)) and handle the None explicitly. In other words, you can't fail to do a "null check" on Option, and non-option values can't be "Null". The type system guarantees this. It is the case, that Option gets optimized such that the None is represented by a null pointer. But that's an optimization you rarely have to care about.

  • @Kaizala1933

    @Kaizala1933

    Жыл бұрын

    @@KohuGaly Thanks for you feedback guys!!

  • @Speykious
    @Speykious2 жыл бұрын

    Minimal runtime? But there's none... I mean, there's 3 Mb of std library code but no runtime

  • @dmitriidemenev5258

    @dmitriidemenev5258

    2 жыл бұрын

    Well, technically there is some. Rust "runtime" zeros out memory here and there before startup. It's little, tho.

  • @Speykious

    @Speykious

    2 жыл бұрын

    @@dmitriidemenev5258 No I mean, there is no external program that runs your program under the hood, like Python interprets Python, Node.js JIT-compiles JavaScript or Dotnet interprets C# bytecode. I'm not talking about default code embedded in the program itself. Do I misunderstand the meaning of "runtime"?

  • @dmitriidemenev5258

    @dmitriidemenev5258

    2 жыл бұрын

    @@Speykious Different people put different ideas into that word. What you're describing is what I would call runtime environment. There's a "What does it mean by C++ runtime?" question on StackOverflow. There some people explain what they mean by this.

  • @Speykious

    @Speykious

    2 жыл бұрын

    @@dmitriidemenev5258 Thanks, I guess that clears it up.

  • @rowans.corner
    @rowans.corner2 жыл бұрын

    I can already hear the claws of the Rustaceans. It is too late now. Good-bye. This is a joke btw

  • @sstyle9335
    @sstyle93352 жыл бұрын

    This looks a lot like a No Boilerplate video. If you did use his format, please credit him for it

  • @31redorange08

    @31redorange08

    2 жыл бұрын

    No.

  • @deardeer1998
    @deardeer19982 жыл бұрын

    C'mon man, aknowledge you do use NoBoilerplates video narration style and deal with it. You will have your hard work recognized and your name cleared. I wish we had Rust-like best practices enforcement in video-making too...

  • @EvanBoldt
    @EvanBoldt2 жыл бұрын

    I tried a small project in Rust recently. Usually differences between languages seem very small enough you could almost forget the language, but Rust needs you to understand some significant concepts first. It took a bit to learn, but I did experience the phenomenon of the code working the first time once actually compiled.

  • @adaum79
    @adaum79 Жыл бұрын

    Great vídeo!

Келесі