The Rust Survival Guide

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 มิ.ย. 2024
  • Think Rust is hard? In this video, I'll guide you through the essential aspects of Rust programming. These topics often pose challenges, leading developers to the brink of frustration. By the end of this tutorial, you'll be armed with the knowledge to write Rust code confidently.
    FREE Rust cheat sheet: letsgetrusty.com/cheatsheet
    Rust strings explained: • Strings in Rust FINALL...
    Rust strings explained 2: • All Rust string types ...
    Chapters:
    0:00 Intro
    0:45 Memory Management
    2:18 Ownership
    5:19 Borrowing
    10:02 Lifetimes
    11:53 Conclusion
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 288

  • @letsgetrusty
    @letsgetrusty  6 หลายเดือนก่อน +19

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

    • @essentialG
      @essentialG 4 หลายเดือนก่อน +3

      I know it took effort to create and all that stuff but come on, remove the registration bs and just make it free to download or just don’t at all.

    • @lollol-se9ng
      @lollol-se9ng 3 หลายเดือนก่อน

      ​@@essentialGI support It doesn't look like it's free if you have to sign up.

  • @user-hn1cy5ee5l
    @user-hn1cy5ee5l 6 หลายเดือนก่อน +59

    In the example with pushing an element to the vector you introduced a bug, when you put last element in the variable there was the last element of the vector before it was modified (not 4), but after you swap lines in the last there will be always 4. That's why when you fight with borrow checker you might introduce bugs in business logic. But in this case I believe unit tests are good option to fix that.

  • @steamer2k319
    @steamer2k319 6 หลายเดือนก่อน +71

    Finally a brief/quick explanation/example for lifetimes!
    Apparently, I've missed the part about the generic collapsing to the shortest duration among matching arguments each time I've tried to learn.
    That part of the vid could be its own clip/short.
    Using the colored vertical lines is a great way to visualize the lifetimes. You could also add inline color to the matching variable references.

    • @MasterHigure
      @MasterHigure 6 หลายเดือนก่อน +6

      The "longest of two strings" is the example from The Book, and everyone uses it, but very few explain what's actually going on. This video is no better in that regard. One video that does explain what's going on (or at least is honest about the fact that there is more going on, and tries to begin pulling on that string, because it's way too much to cover in 10 minutes), see "but what is lifetimes" by leddoo. For a more thorough introduction, Jon Gjengset has an hour and a half of "Crust of Rust: Lifetime Annotations".

    • @steamer2k319
      @steamer2k319 6 หลายเดือนก่อน +2

      @@MasterHigure
      Thanks for the pointers to some deeper dives. But yeah, what I appreciate about this video, is that it gets the gist across very concisely/quickly by leveraging animation/visualization.

    • @erkintek
      @erkintek 6 หลายเดือนก่อน

      So how to solve it?

  • @forestcat512
    @forestcat512 6 หลายเดือนก่อน +18

    Ive never watched anything about rust or memory stuff in general but still understood most of the things you explained. I would say you did an amazing job at explaining it

  • @Sergio-ds3sq
    @Sergio-ds3sq 6 หลายเดือนก่อน +35

    You explain stuff really well bro, thank you!!

  • @mikhalpalych
    @mikhalpalych 6 หลายเดือนก่อน +6

    I have just wrote down these rules into anki cards after watching video from your rust playbook's course yesterday. I have repeated these cards already for like 3 times and i can say that starting learning rust through spaced repetition is greatest decision i made and i recommend this way for everybody

  • @grzegorzl4825
    @grzegorzl4825 6 หลายเดือนก่อน +7

    Explained both simply and with details. Really good work!

  • @indylawi5021
    @indylawi5021 3 หลายเดือนก่อน +1

    Thank you for highlighting these Rust essentials in memory management as well as your clear explanation.

  • @nicklesseos
    @nicklesseos 6 หลายเดือนก่อน +6

    Wow I can really tell the quality of your content has gone up. Bravo! Good job

  • @ZachariahCavazos
    @ZachariahCavazos 6 หลายเดือนก่อน +2

    Wow.... incredible concise and informative. The line illustrations really helped. I feel like cracking back into rust for some longer running data processing I have to do. Thank you again, looking forward to smart pointers video!

  • @bernoulli884
    @bernoulli884 6 หลายเดือนก่อน +4

    Really clear and concise! Nice work.

  • @DogeOfWar
    @DogeOfWar 6 หลายเดือนก่อน +14

    Really good teaching by example here. I feel like a lot of the time words themselves fail to illustrate concepts like this. Seeing how it works with actual code really cements it. Please keep making videos like this where you can demonstrate such concepts, thanks!

    • @kevinmcfarlane2752
      @kevinmcfarlane2752 6 หลายเดือนก่อน +1

      I find with a lot of tech, I need to learn from a combination of reading, listening, watching and practicing. I pick up different things from each medium.

    • @DogeOfWar
      @DogeOfWar 6 หลายเดือนก่อน

      @@kevinmcfarlane2752Totally agree, some things are easier to learn from theory than practice and vice versa.

  • @cheebadigga4092
    @cheebadigga4092 5 หลายเดือนก่อน

    I tried it the last couple days and I practically fell in love with the language. rustc and rust-analyzer are incredible! And the language itself is amazing once the light bulb switches on in the back of your brain. I'm pumped :D
    Your channel is a gem by the way! Thanks!!

  • @leokim4943
    @leokim4943 6 หลายเดือนก่อน +6

    you are an amazing educator! i look forward to your Rust bootcamp 🦀

  • @aryanrahman3212
    @aryanrahman3212 6 หลายเดือนก่อน +6

    Wow this was really well explained video of one of the central concepts of Rust!

  • @zamokuhleshozi4494
    @zamokuhleshozi4494 6 หลายเดือนก่อน +16

    You need to make a course, well explained🙌🏽.

  • @boliu5051
    @boliu5051 5 หลายเดือนก่อน

    great job! please continue this series.

  • @danielmichalski2436
    @danielmichalski2436 3 หลายเดือนก่อน

    You have earned my subscription, Sir. Great video; very well presented! ❤

  • @RichardWalterLanda
    @RichardWalterLanda 6 หลายเดือนก่อน

    a small rusty island of understanding in this youtube, thank yu, keep going!

  • @nmereginivincent5772
    @nmereginivincent5772 6 หลายเดือนก่อน +2

    This video is insightful. Thank you

  • @codeman99-dev
    @codeman99-dev 6 หลายเดือนก่อน +12

    6:20 Moving `x.push(4);` up a line changes the behavior. Can we instead move it below the print statement? Maybe wrap the let and println statements into their own scope?

    • @steamer2k319
      @steamer2k319 6 หลายเดือนก่อน +4

      ...or clone/dereference the value of `last()` so that the value that we add to the local stack (variable reference) *is* the integer rather than a pointer into the heap.

    • @yash1152
      @yash1152 6 หลายเดือนก่อน +2

      7:15 yeah i was thinking same. thanks for mentioning it.
      this particular example shown in video is not practical, but i reckon that he was just focussing on the borrow validation.

    • @codeman99-dev
      @codeman99-dev 6 หลายเดือนก่อน

      @@yash1152 it is pretty practical actually. It actually proves the rule is incorrect as stated. The actual compile error speaks in terms of time / location of usage.

    • @IshCaudron
      @IshCaudron 5 หลายเดือนก่อน +1

      This. Fixing a problem by writing the wrong business logic is not a good advice.

  • @ronny332
    @ronny332 4 หลายเดือนก่อน

    Especially the lifetimes section was bery helful, thank you!

  • @MK-fw9qo
    @MK-fw9qo หลายเดือนก่อน

    Your channel is a gem bro thank you so much

  • @StingSting844
    @StingSting844 6 หลายเดือนก่อน +4

    Tbh I got like 50% of it as I've never coded in rust. I hope this would be of great value when we start rust in our project next month

  • @AadilValconi
    @AadilValconi 3 หลายเดือนก่อน

    While it might not have been intentional this video does a great job convincing and explaining why Rust is so fast and memory efficient.
    also when I started learning programming Lifetimes is how I imagined a garbage collector worked but was shocked to learn most garbage collector eat up runtime to cleanup your memory. Rust seems like a fun language to learn.

  • @morrsor
    @morrsor 6 หลายเดือนก่อน +1

    I’d like to see more content like this. Big thumbs up 👍

  • @datguy4104
    @datguy4104 5 หลายเดือนก่อน +2

    I'm already well into Go as a self taught programmer, likely even employable at this point. My only concern with Rust is the job market, are their even jobs for it? Everything else about it is great, even the way it manages memory is pretty straight forward.

  • @TimDrogin
    @TimDrogin 5 หลายเดือนก่อน +1

    i studied rust for like 3 months, but now in the uni working on a c++ project i am unintentionaly doing everything rust style. Enums, optionals, etc

  • @theultimateevil3430
    @theultimateevil3430 6 หลายเดือนก่อน +3

    The problem with Garbage Collector is not always the runtime overhead, but inconsistent freezes up to a few milliseconds when it's doing the garbage collection. A program in Go will have spikes of cpu load whereas the same program in Rust will have slightly higher median load but more spread out and predictable.

    • @JorgetePanete
      @JorgetePanete 6 หลายเดือนก่อน +1

      I think Java's Generational ZGC is interesting, it has sub-ms pauses

  • @soma_rc
    @soma_rc 6 หลายเดือนก่อน

    Thanks for the clear explanation. Will be pointing ppl here if they struggle.

  • @luigitech3169
    @luigitech3169 6 หลายเดือนก่อน

    Thanks, waiting for part2

  • @SirSomnolent
    @SirSomnolent 6 หลายเดือนก่อน

    My dude this was super helpful thanks

  • @Vibrationofawesome
    @Vibrationofawesome หลายเดือนก่อน +1

    Feel like I gotta watch this so many times. Rust is my first programming language I’m learning. I’m stubborn so I feel like I can do this!

  • @rorysanchez
    @rorysanchez 6 หลายเดือนก่อน +1

    Great explanation dude

  • @durza9390
    @durza9390 6 หลายเดือนก่อน +1

    Clean explaination. Thx!

  • @putzz67767
    @putzz67767 6 หลายเดือนก่อน

    Linda explicação!! Parabéns pela didática!!

  • @joergw
    @joergw 6 หลายเดือนก่อน

    Thanks. That was easy to understand 😊

  • @AlistairClark99
    @AlistairClark99 6 หลายเดือนก่อน +1

    Excellent explanation!

  • @ducksies
    @ducksies 6 หลายเดือนก่อน +1

    Excellent explanations

  • @ChrisPatti
    @ChrisPatti 6 หลายเดือนก่อน +1

    Great video! Thanks for making it!
    I was following everything perfectly until we got to the section on lifetimes. I felt like that was a bit rushed and included a bunch of information that wasn’t explained.
    that aside this is one of the best simplest explanations of ownership and borrowing in rust I’ve seen. Thank you!

    • @OrbitalCookie
      @OrbitalCookie 3 หลายเดือนก่อน

      Rust's borrow checker checks lifetimes one function at a time. The function signature contains everything necessary to know if there are borrowing mistakes in it. Without this understanding, borrow checker might seem as this complex system that traces lifetimes across modules. Nope. One function at a time. The function signature is the key to understanding lifetimes.

  • @dracodevil.
    @dracodevil. 6 หลายเดือนก่อน +2

    Great video! We want more!
    Thanks!

  • @piguyalamode164
    @piguyalamode164 6 หลายเดือนก่อน +1

    11:04 another way to phrase this is that the lifetime annotations here tell the borrow checker that a and b must live at least as long as the returned value needs to live.

  • @sergiuoanes4635
    @sergiuoanes4635 6 หลายเดือนก่อน

    Excellent video! Thanks

  • @adrianopallavicino906
    @adrianopallavicino906 6 หลายเดือนก่อน

    Thank you, this video is very useful!

  • @yakovlev_io
    @yakovlev_io 6 หลายเดือนก่อน +2

    Great explanation, thank you

  • @oleksiistri8429
    @oleksiistri8429 6 หลายเดือนก่อน +2

    Could you make a video about most common pitfalls that newcomers fall into? I made same script on NodeJS, Bun and Rust and for some reason the one on Rust has the worst performance. Mostly I used: strings and &str, async functions, reading / writing files and actix-web framework. I understand what you described in this video, but still failed to get good performance

  • @Nonsense116
    @Nonsense116 6 หลายเดือนก่อน +1

    Tbh I think ownership, borrowing, and lifetimes are the easiest topics to learn in rust just because there is SO MUCH content on these topics. If you were doing a memory management video I wish you would've gone into things like Box, Ref, ARef. There isn't a ton of content already out there

  • @joseandkris
    @joseandkris 6 หลายเดือนก่อน +2

    Great video, thanks for making it :)

  • @christianventes2553
    @christianventes2553 6 หลายเดือนก่อน +4

    My problem with rust evangelist is when people say is not easy, and they inmeditialy start showing the incredible way rust is super optimal, wich is true but that doesn't alievate the learning curve.
    I love your survival guide because you really show us how is it done

    • @meanmole3212
      @meanmole3212 6 หลายเดือนก่อน +1

      The reason why Haskell failed compared to Rust is that the Haskell community's attitude towards people who complained about the complexity of the language was along the lines of "Maybe you are not smart enough for the language like we are? Too bad, because this language is superior to every other language once you understand it.". Rust took different approach and invested heavily in material that focused on making the language as easy to learn as possible through official language book / tutorial, in-code documentation code examples (for every standard library function you have instant access to not only the documentation of what the function does but how it is used with runnable code examples) and community efforts.

    • @kevinmcfarlane2752
      @kevinmcfarlane2752 6 หลายเดือนก่อน

      @@meanmole3212Yes, imagine if Rust didn’t have that stuff. Many would just have moved on after the first hour.

    • @ericbwertz
      @ericbwertz 6 หลายเดือนก่อน

      @@meanmole3212 The century is still young -- Haskell still might catch on, but I'm hoping that something Lisp-y will get there first.

    • @NicolaiSyvertsen
      @NicolaiSyvertsen 6 หลายเดือนก่อน

      Evangelists have already climbed the learning curve (or at least I hope so, though I know some who evangelize even when they barely know stuff themselves).

  • @lovenangelodayola1826
    @lovenangelodayola1826 6 หลายเดือนก่อน +1

    Well explained!!! ❤🎉

  • @mista_ia
    @mista_ia 4 หลายเดือนก่อน

    Great explanation. As newbie, 10:42 when defining lifetimes, did you choose to name it by character "a", is it rust convention, or is it related to the function parameter a ?

  • @erlangparasu6339
    @erlangparasu6339 6 หลายเดือนก่อน

    best explanation thank you so much!

  • @liamwoodleigh
    @liamwoodleigh 6 หลายเดือนก่อน

    Great stuff Bogdan 👏

  • @user-zn3zx6fk7u
    @user-zn3zx6fk7u 6 หลายเดือนก่อน

    hey im curious, what video editor did you use? and how did you color the (code) text ?

  • @mushonnip
    @mushonnip 6 หลายเดือนก่อน +1

    new to rust, finally here I know what is

    • @peter9477
      @peter9477 6 หลายเดือนก่อน

      It's pretty typical to use 'a as a "throwaway" lifetime when you don't think it's important to give it a better name. Just habit in this case.

  • @ALucaRD807
    @ALucaRD807 3 หลายเดือนก่อน

    The fact this video never mentioned reference counting drops its significance by a lot.
    "If you
    have objects that are used in multiple places and passed around, and
    you don't have refcounts, your code is almost certainly broken." (c) Linux documentation for krefs

  • @remssi-dev
    @remssi-dev 6 หลายเดือนก่อน +4

    Never used rust, but it seems super interesting

  • @ramprasadpoudel8170
    @ramprasadpoudel8170 6 หลายเดือนก่อน

    more video of lifetimes please, especially its annotation in struct

  • @liminal6823
    @liminal6823 6 หลายเดือนก่อน +2

    6:33 just to clarify: the immutable borrow here is the last *element* of x eg. the &i32 which is returned by last - not x itself and then below that, the mutable borrow is &self which is x itself? Man I'm so confused...halp meeeeeee

  • @djasniverajaona9163
    @djasniverajaona9163 3 หลายเดือนก่อน

    Waouh, Rust is so different from everything i've seen until now.

  • @bobschaaf2549
    @bobschaaf2549 6 หลายเดือนก่อน

    "The Karen of all compilers". Priceless! You have a hot channel. Keep up the great work.

  • @cornelis4220
    @cornelis4220 6 หลายเดือนก่อน

    Thanks. Doing Gods work❤

  • @charlesstepp129
    @charlesstepp129 2 หลายเดือนก่อน

    This is a good reference vid.

  • @ora-ora-ora
    @ora-ora-ora 6 หลายเดือนก่อน

    This video should be included in the official documentation

  • @quentin7343
    @quentin7343 6 หลายเดือนก่อน +1

    Great content.

  • @steamer2k319
    @steamer2k319 6 หลายเดือนก่อน +1

    At 7:13, doesn't moving the call to last() after push() change the value of the `last` variable to 4 instead of 3?

    • @henzosabiq
      @henzosabiq 6 หลายเดือนก่อน

      Yup, it does change the behavior. If you want to add 4 to the list while still having `last` to evaluate to 3, move `x.push(4)` below the println. He gets the main point delivered, but code examples could be better.

  • @monkeygame7
    @monkeygame7 6 หลายเดือนก่อน +1

    I guess this is kind of nitpicky, but in the first example for explaining the borrow checker (7:10 ish) the code you change it to doesn't do the same thing as it did before you moved the push. Before resolving the borrow checker, it would print 3, but after you "fixed" it, it would print 4. I feel like it wrongly gives the impression that some things aren't "possible" in Rust when there is a way to do it, you just have to be explicit about how the memory is managed (e.g. use a box or something). But I get not wanting to over-complicate it; it probably would have been more accurate/good enough to just move the push after the print, which would maintain the same behavior. Great video nonetheless!

    • @codeman99-dev
      @codeman99-dev 6 หลายเดือนก่อน

      Actually, you just need to move the push down, making it after the print statement. He stated the rule incorrectly. An immutable reference can exist here, but no mutations should happen before the use of the immutable reference.
      This is fine:
      fn main() {
      let mut x = vec![1, 2, 3];
      let last = x.last().unwrap();
      println!("{:?}", last);
      x.push(4);
      println!("{:?}", x);
      }

    • @codeman99-dev
      @codeman99-dev 6 หลายเดือนก่อน

      In fact, the error speaks in terms of time / location of usage. It does not say "cannot make an immutable borrow".
      Ref: rustc --explain E0502

  • @ahmadrezadorkhah9574
    @ahmadrezadorkhah9574 6 หลายเดือนก่อน +1

    Thanks i have better understanding of lifetime now

  • @nirajpaudel6072
    @nirajpaudel6072 2 หลายเดือนก่อน

    Awesome video. :)

  • @kamertonaudiophileplayer847
    @kamertonaudiophileplayer847 6 หลายเดือนก่อน +2

    Thanks for keeping Rust alive. I noticed that an interest to Rust dropped recent time. Finding a Rust job becomes more complex and time consuming.

  • @quasi_verum
    @quasi_verum 4 หลายเดือนก่อน

    the next one that need to be discussed that not being mentioned => closure behavior over function, trait satisfying with derive.

  • @PurpleLibRight
    @PurpleLibRight 6 หลายเดือนก่อน +142

    Please create a Rust bootcamp.

    • @alwaysahad
      @alwaysahad 6 หลายเดือนก่อน +4

      Please..... @letsgetrusty

    • @darukutsu
      @darukutsu 6 หลายเดือนก่อน +8

      Read rustbook

    • @Etanmm
      @Etanmm 6 หลายเดือนก่อน +24

      He already did lmao

    • @firefuegomakes
      @firefuegomakes 6 หลายเดือนก่อน +1

      I second this, from South Africa 🌍

    • @omerdvir1709
      @omerdvir1709 6 หลายเดือนก่อน +2

      He did, 2 years ago

  • @why2jjj
    @why2jjj 6 หลายเดือนก่อน

    Keep it up, more please :)

  • @BooleanIndecisive
    @BooleanIndecisive 6 หลายเดือนก่อน +2

    This is definitely a video about Rust. Yes indeed.

  • @dixztube
    @dixztube 4 หลายเดือนก่อน

    Awesome video

  • @IshCaudron
    @IshCaudron 5 หลายเดือนก่อน

    Rule one of borrowing is wrong as the intended result of the not compiling version is not the same as the proposed solution. You introduce a bug in the code to satisfy the borroww checker.

  • @torarinvik4920
    @torarinvik4920 6 หลายเดือนก่อน

    The borrow checker is a really smart solution or in general escape analysis. I think the next step would be to do something that Nim and perhaps Swift does. It moves values by default like in Swift but when it notices a shared value it reverts back to reference counting. This way you should get very good performance perhaps even optimal performance when they perfect this formula. In other words zero-overhead memory management. IMHO manual memory management is on life-support and will not be done in the future, how soon it will be a thing of the future I cannot predict. It might be 5 years, 10 years or even 15+ years.

    • @theninjascientist689
      @theninjascientist689 6 หลายเดือนก่อน +1

      Rust tries to avoid doing things "by default" and instead relies on the programmer to tell it how to handle a situation. Explicit ".clone()"s, borrows and moves make it very easy to avoid memory bugs and work alongside other programmers who's brains you do not have access to.

    • @torarinvik4920
      @torarinvik4920 6 หลายเดือนก่อน

      @@theninjascientist689 That is true. But the point I was trying to make was that the "relies on the programmer to tell it how to handle a situation" will eventually be a thing of the past. There was a time when handwriting assembly was the best solution because compilers were not yet good enough for optimal code. In the meantime, until automatic memory management becomes the norm, the borrow checker will be a vital tool in most system languages.

    • @xdanic3
      @xdanic3 6 หลายเดือนก่อน

      I was looking at gdscript vs C# and one comment said reference counting is garbage collection, just another form of it, I wonder what could be argued against that.

    • @torarinvik4920
      @torarinvik4920 6 หลายเดือนก่อน

      @@xdanic3 Yeah, garbage collectors AFAIK uses reference counting to track lifetimes. However, Swift uses something they call "automatic reference counting" ARC. I'm not sure exactly how it works, though, but they claim it's not a garbage collector.

  • @bombrman1994
    @bombrman1994 3 หลายเดือนก่อน

    this was amazing

  • @kchaitanya39
    @kchaitanya39 6 หลายเดือนก่อน +1

    Beautiful video

  • @hailuong9295
    @hailuong9295 6 หลายเดือนก่อน +3

    well C# actually give you low level control compare to Kotlin, it has directly support safe pointer through Memory class, direct stack allocate through Span, and natively support struct too compare to non struct-ish in Kotlin. And it also has native SIMD support compare to Swift. And last thing you alway use raw pointer or do non GC memory manipulate through unsafe

    • @metaltyphoon
      @metaltyphoon 6 หลายเดือนก่อน +1

      From all the languages showed, outside of C, C++ and Rust, C# is the one that gives you the lowest level control.

  • @harikrishnanb7273
    @harikrishnanb7273 6 หลายเดือนก่อน

    need a follow-up video!!

  • @CODEDSTUDIO
    @CODEDSTUDIO 6 หลายเดือนก่อน +2

    Great Video

  • @PurpleLibRight
    @PurpleLibRight 6 หลายเดือนก่อน

    How do I use wasm-bindgen to use yew and nodejs in vitejs?

  • @dakata2416
    @dakata2416 6 หลายเดือนก่อน +7

    Rust players when they stumble upon this video...

  • @taylors1545
    @taylors1545 6 หลายเดือนก่อน

    Zig is a strong contender, newer so not quite on par with Rust yet but it's getting there.

  • @GrenYT
    @GrenYT 2 หลายเดือนก่อน

    Is it not possible to lie to the compiler and cause memory errors with the generic lifetimes bit? Feels like it could be possible....

  • @rtdietrich
    @rtdietrich 5 หลายเดือนก่อน

    Amazing Video. Wow ===>> Very good Job well done!!!!! Big hug!

  • @Light_Akira
    @Light_Akira 6 หลายเดือนก่อน +2

    my personal pain in rust is that when i need an async\parallel code, i have to convert my types into Arc. the verbosity of it is a problem in itself.
    you never know in advance what piece of code will you want to parallelize. thus use it by default is not a solution.
    so borrowing is not the main issue, as i will have to clone Arc to pass it in a function. the main problem is in the complex refactoring and in the flexibility of the code.

    • @theintjengineer
      @theintjengineer 6 หลายเดือนก่อน +2

      Precisely. It's all flowers when you're dealing with easy scenarios. But as soon as you get to the Boxes, Rcs, Arcs, RefCells, mixed with all the other stuff, then I can't really see the difference between my C++ Programs and Rust's haha. The difference is that C++'s Syntax is prettier in my humble opinion.

  • @HARUN-AKSU
    @HARUN-AKSU 5 หลายเดือนก่อน

    Which softwares do you use for creating videos?

  • @krzysztofjuszczak906
    @krzysztofjuszczak906 6 หลายเดือนก่อน +1

    Honestly it sounds rather intuitive, simple even, when youre learning about it.
    then you try to actually do anything

    • @kevinmcfarlane2752
      @kevinmcfarlane2752 6 หลายเดือนก่อน +1

      Yep. Exactly what I just said a couple of minutes ago! 😊 But you just have to keep plugging away. It’s satisfying when you get there.

    • @krzysztofjuszczak906
      @krzysztofjuszczak906 6 หลายเดือนก่อน

      @kevinmcfarlane2752 is it really worth it tho? some of the most elegant, concise and clean code I've seen was written in rust. but the opposite is also true. if there's not an idiomatic way to do something, the code ends up looking really ugly and unsatisfying

  • @HereIsZane
    @HereIsZane 6 หลายเดือนก่อน

    My main issue is I can't figure a side project to hone in all the fundamental stuff that isn't too complex

  • @seasong7655
    @seasong7655 6 หลายเดือนก่อน

    Anyone noticed how the compiler will give a lifetime annotation error even when there's not inner scope? Also the compiler didn't see s1 is always returned. There was no need to even annotate the lifetimes, but the compiler still made you do it

    • @ericbwertz
      @ericbwertz 6 หลายเดือนก่อน +1

      An inner scope is only one way that this can happen -- any transfer of ownership will cause this to happen.
      It IS the case that the compiler could figure out some of these lifetime contentions, but not all of us have that much time.

  • @ericbwertz
    @ericbwertz 6 หลายเดือนก่อน

    title should be "The First of Many Rust Survival Guides"

  • @paw565
    @paw565 5 หลายเดือนก่อน

    Lifetimes made my head explode 🤯

  • @alexanderneishkasha7903
    @alexanderneishkasha7903 6 หลายเดือนก่อน +1

    I can say that ownership concept is kind of easy to understand. The most difficult for me in rust are macros. Looks like something weird that shouldn't be in this language.

    • @theninjascientist689
      @theninjascientist689 6 หลายเดือนก่อน +1

      Macros are indeed weird, but they're kind of already not in the language. Rust macros are code that writes Rust code. Most beginners shouldn't be reaching for macros as a tool to solve their problems.

    • @edgeeffect
      @edgeeffect 6 หลายเดือนก่อน

      Procedural Macros are one of the things that attracted me to Rust.

    • @NicolaiSyvertsen
      @NicolaiSyvertsen 6 หลายเดือนก่อน +1

      Macros is unfortunately needed in order to simplify a lot of stuff that is incredibly tedious to write in pure rust. It is used extensively in language bindings. There is a reason people complain so much about boiler plate in C and or make ad-hoc code generators on a project by project basis. But it seems that Zig's comptime is a better way to do it.

    • @theninjascientist689
      @theninjascientist689 6 หลายเดือนก่อน

      @@NicolaiSyvertsen Can you give me some examples of what you've had to write macros for? I'm curious

  • @obkf-too
    @obkf-too 6 หลายเดือนก่อน +1

    I wouldn't use Rust for everything, but it is complementary to my other languages (I mainly use Python since I am a Django web developer).
    However, I find that Rust is the least frustrating language to use (I don't trust google that much to use Go) for low level programming, and I really don't think it's hard, I has a different perspective, It's "Different" not hard, tho the syntax sucks (IMO).

  • @leshommesdupilly
    @leshommesdupilly 6 หลายเดือนก่อน +1

    Karen rust compiler vs Chad cpp compiler:
    -Compile this bro.
    -Yes master.
    -> Segfault

  • @iZucken
    @iZucken 2 หลายเดือนก่อน +2

    The real trick to surviving rust is getting a jib...

  • @BogdanSerban
    @BogdanSerban 3 หลายเดือนก่อน

    Aren't lifetimes just global variables as in C/C++?

  • @psykespb9532
    @psykespb9532 6 หลายเดือนก่อน

    Lifetimes are annotated with single quotes, not ticks.
    > Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not