Akon32
а почему при
waiters: Weak<Mutex<HashMap<TaskId, TaskResultReceiver>>>, (здесь tokio::..::Mutex, std::sync::Weak)
при вызове
let mut ws = self.waiters.upgrade().unwrap().lock().await;
я получаю
error[E0716]: temporary value dropped while borrowed
--> src/-----:310:22
|
310 | let mut ws = self.waiters.upgrade().unwrap().lock().await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
| |
| creates a temporary which is freed while still in use
...
325 | }
| - borrow might be used here, when `ws` is dropped and runs the `Drop` code for type `tokio::sync::MutexGuard`
|
= note: consider using a `let` binding to create a longer lived value
? что должно быть в новой переменной?