【发布时间】:2018-06-19 03:14:05
【问题描述】:
为什么我不能这样做?
pub fn start_workers(&mut self) {
// start all the worker threads
self.dispatch_thread = Some(spawn(||{
for _i in 1..10 {
println!("Price = {}", 10);
thread::sleep(time::Duration::from_secs(1));
}
}));
self.dispatch_thread.unwrap().join();
}
我收到以下错误,
error[E0507]: cannot move out of borrowed content --> src/orderbook.rs:195:9 | 195 | self.dispatch_thread.unwrap().join(); | ^^^^ cannot move out of borrowed content
【问题讨论】:
-
感谢格式更正!
标签: rust