You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the element commented out, it works fine. When I add it again I get this error:
93 | let top_products:Vec<ItemAndCount> = vec![];
| ------------ captured outer variable
...
98 | / rsx! {99 | | <Element100 | | styles={props.styles.clone()}101 | | >
... |
104 | | {VecTracker::from(top_products.iter().map(|item| {
| | ------------
| | |
| | variable moved due to use in closure
| | move occurs because `top_products` has type `std::vec::Vec<ItemAndCount>`, which does not implement the `Copy` trait
... |
110 | | </Element>
I asked this question in discord, but it seems the consensus was that it wasn't possible due to closures created by the macros.
Could someone confirm if this is the case? Or does anyone have a workaround?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I get an error about a variable that is moved inside a closure, only when a part of the UI is wrapped in another element. Example:
With the element commented out, it works fine. When I add it again I get this error:
I asked this question in discord, but it seems the consensus was that it wasn't possible due to closures created by the macros.
Could someone confirm if this is the case? Or does anyone have a workaround?
Beta Was this translation helpful? Give feedback.
All reactions