Smarter Programming in Rust: Master 'move' Now!

Поділитися
Вставка
  • Опубліковано 7 лют 2025

КОМЕНТАРІ • 16

  • @alighahremani4626
    @alighahremani4626 4 місяці тому +1

    Your channel is so underrated bro!
    keep pushing it.

    • @FloWoelki
      @FloWoelki  4 місяці тому +1

      Thank you, man :)

  • @havocthehobbit
    @havocthehobbit 4 місяці тому

    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 7 місяців тому

    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  7 місяців тому

      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.

  • @Fantaztig
    @Fantaztig Рік тому

    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  Рік тому +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 Рік тому

      @@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  Рік тому +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 7 місяців тому

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

    • @FloWoelki
      @FloWoelki  7 місяців тому

      @@davidbriggs8109 true fact :D

  • @critamine
    @critamine 6 місяців тому +2

    Why is this the only video on move 😭

    • @FloWoelki
      @FloWoelki  5 місяців тому +1

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

  • @BharadwajAvva
    @BharadwajAvva 7 місяців тому +3

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

    • @jasdfpasdfakdsjhfa
      @jasdfpasdfakdsjhfa 3 місяці тому

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

  • @verox6309
    @verox6309 2 місяці тому

    Mach doch Videos auf deutsch. Gute englische Kanäle gibts schon ohne Ende, professionelle deutsche besonders für Rust nicht so