lazy_static! {
static ref MY_GLOBAL: Mutex<usize> = Mutex::new(100);
}
MY_GLOBAL.lock().unwrap() += 1;
这段代码给了我这些错误:
cannot use `+=` on type `MutexGuard<'_, usize>`
cannot assign to this expression
我如何变异MY_GLOBAL
?
lazy_static! {
static ref MY_GLOBAL: Mutex<usize> = Mutex::new(100);
}
MY_GLOBAL.lock().unwrap() += 1;
这段代码给了我这些错误:
cannot use `+=` on type `MutexGuard<'_, usize>`
cannot assign to this expression
我如何变异MY_GLOBAL
?