3 ms·
It’s cool! In general, the default is “rust tries to capture each thing the way it needs to be” and you can use move to override that. Sometimes, you do have to
by steveklabnik 8y ago
It’s cool! In general, the default is “rust tries to capture each thing the way it needs to be” and you can use move to override that. Sometimes, you do have to do what you wrote, at least in theory. I’ve never actually had to.
- chrismorgan 8y agoIf your closures need to be 'static, it’s common in my experience to need to use `move`, and thus to need to clone types like Rc<T>. It depends on whether you’re dealing with Fn, FnMut or FnOnce, too.