Smarter Programming in Rust: Master 'move' Now!

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

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

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

    Your channel is so underrated bro!
    keep pushing it.

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

      Thank you, man :)

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

    so if I want to use "p" again after the closure which now owns it, is the only way , to return the value and redeclare be to assign it from the closure return ?

  • @JC-wj5ks
    @JC-wj5ks 5 หลายเดือนก่อน

    I actually came to this video from using Leptos. It still not clear to me how leptos manages to use the move keyword all over the components and not run into borrowing/ownership issues.

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

      Awesome! :)
      Maybe for clarification: the `move` keyword is the whole magic and this is explained in this video. `move` is not a Leptos concept and it's used to transfer ownership of variables to a closure.

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

    TH-cam deosn't support speeding the video beyond 2x.

    • @jasdfpasdfakdsjhfa
      @jasdfpasdfakdsjhfa 20 วันที่ผ่านมา

      Haha was thinking the same time. Some people just speak in slow motion.

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

    Why is this the only video on move 😭

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

      I assume I have to say: you're welcome? :D

  • @Fantaztig
    @Fantaztig 10 หลายเดือนก่อน

    To stay within the second example: How would I implement multiple event listeners that access the same element?
    Is this already part of your non-recommendation, meaning there is already a better solution? :)

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

      thank you for the question. one solution would be to just cloning the reference. however, this will have some problems in the future if you just clone a primitive variable. that's why a common way is to use reference counting (using e.g., `Arc` in Rust). this gives you the correct reactivity. i'll probably make a video about that as well.
      i hope that helps :)

    • @Fantaztig
      @Fantaztig 10 หลายเดือนก่อน

      @@FloWoelki Oh I see, Arc is an explicit thread safe pointer, nice!
      Thanks, yeah I have not yet had the chance to start out with rust but I'm trying to understand the syntax and stuff haha :)

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

      exactly. Arc is thread safe (compared to Rc) and is a smart pointer. Rust has a steep learning curve but is a lot of fun :D

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

      @@FloWoelki the steep learning curve is not that high than c++ smart pointer 😂

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

      @@davidbriggs8109 true fact :D