gpt4 book ai didi

rust - 借用检查器 "cannot move out of borrowed content"

转载 作者:行者123 更新时间:2023-11-29 08:23:29 25 4
gpt4 key购买 nike

为什么我不能这样做?

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

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com