Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Parent is saying that you can declare your closure 'move' and move references rather than values, therefore getting the mixed behavior you described. You don't have to move all values.


If you want to copy in such cases in Rust, you need to copy to dummy variables that are then moved into the closure, a common pattern in Gtk-rs that even deserves a macro to simplify the boilerplate.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: