Rust: Error Handling

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 พ.ย. 2024

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

  • @UliTroyo
    @UliTroyo ปีที่แล้ว +8

    You can tell a great explanation from a middling one when at the end you go "wait, THIS is what I wasn't getting?" instead of "oh, I think I understand now". Really well-thought-out demo; thanks!

  • @josephlyons3393
    @josephlyons3393 ปีที่แล้ว +10

    Unwraps are also good to use in tests for things that should be there. If it panics, the test will fail!

  • @OuranianCyclops
    @OuranianCyclops ปีที่แล้ว +2

    this is by far the best explanation of error handling in rust ever

  • @antonaparin
    @antonaparin ปีที่แล้ว +1

    13:35 ... and use a really cool feature inside Swift

  • @zeroows
    @zeroows 2 ปีที่แล้ว +7

    13:37 should be rust not swift - great vid. thank you

  • @anderslundstrom4388
    @anderslundstrom4388 2 ปีที่แล้ว +1

    Just a thought, if u wanted to just read from a file (which is what File::open is used for if i understand correctly), then maby often its not required to actually create one, and if you wanted to write/append to a file, then OpenOptions has .create().append(true).open() unless you want to handle the special case when file does not exist. if so, OpenOption alternative seem to have less nesting, but perhaps this alternative opens up for more kinds of error handling and less convention. But im just beginner so i dont know whats best practice

  • @AliBigdeli
    @AliBigdeli 11 หลายเดือนก่อน

    and how to raise a custom error when you are using the Box method ?

  • @PimpofChaos
    @PimpofChaos 2 ปีที่แล้ว +3

    Does anyone know he font? Looks really slick!

    • @TheDevMethod
      @TheDevMethod  2 ปีที่แล้ว +1

      I usually use Fira Mono

  • @FugalBaboon
    @FugalBaboon ปีที่แล้ว +1

    wow really great explanation!

  • @alexandredaubricourt5741
    @alexandredaubricourt5741 ปีที่แล้ว

    What's your theme?

  • @fabienpenso
    @fabienpenso 2 ปีที่แล้ว

    Do you know why kind() isn’t available in anyhow? That’s useful

  • @scigama71
    @scigama71 11 หลายเดือนก่อน

    Thank you

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

    13:30 swift?

  • @apidas
    @apidas 2 ปีที่แล้ว +2

    subscribed

  • @jeffg4686
    @jeffg4686 ปีที่แล้ว

    We need method aliasing so that we can rename unwrap() on Option and Result to match()...
    I can almost guarantee that's where 1/2 fail. Mind is trying to figure out what's being "unwrapped" (there's nothing to unwrap...).
    Or maybe name it "assert_get_val" for Option and "assert_get_result" for Result.
    Nah - that's too crazy. maybe just "match".
    Now that we have ?, it doesn't matter much.

  • @hiongun
    @hiongun ปีที่แล้ว

    why on earth everything becomes overly complicated when it comes to rust?
    way too verbose... man, it's just error handling!

    • @AJ213Probably
      @AJ213Probably ปีที่แล้ว +2

      Better than try catch hell and functions unexpectedly throwing exceptions. Errors should be values and should be easy to see where they can occur

  • @mrlectus
    @mrlectus 2 ปีที่แล้ว

    Zoom in gosh