Closed baoyachi closed 3 years ago
That's not possible, because that would be unsfae.You are trying to return a pointer inside the value, protected by the mutex, but the pointer is not protected by a lock guard. That means that some other thread could sucesfully lock the mutext and mutate the protected data, invalidating the pointer. You need to either clone the data (using Arc<dyn IExt>
would help) or use something like map from parking lot: https://docs.rs/lock_api/0.4.0/lock_api/struct.MutexGuard.html#method.map
how to get reference
Ext
inCONFIG
compile error: