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 ?
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.
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.
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? :)
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 :)
@@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 :)
Your channel is so underrated bro!
keep pushing it.
Thank you, man :)
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 ?
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.
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.
TH-cam deosn't support speeding the video beyond 2x.
Haha was thinking the same time. Some people just speak in slow motion.
Why is this the only video on move 😭
I assume I have to say: you're welcome? :D
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? :)
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 :)
@@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 :)
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
@@FloWoelki the steep learning curve is not that high than c++ smart pointer 😂
@@davidbriggs8109 true fact :D