-
Notifications
You must be signed in to change notification settings - Fork 169
Closed
Description
Hi
My lazy_static code is:
lazy_static::lazy_static! {
static ref GLOBALE_CASBIN_ENFORCER: AsyncOnce<RwLock<CasbinEnforcer>> = AsyncOnce::new(async {
let ce=CasbinEnforcer::default().await;
RwLock::new(ce)
});
}
when i add dependence rsa to my Cargo.yml
[dependencies]
rsa = "0.7.1"
I got Errors
`*const futures_locks::RwLock<CasbinEnforcer>` cannot be sent between threads safely
the trait `std::marker::Send` is not implemented for `*const futures_locks::RwLock<CasbinEnforcer>`
the trait `std::marker::Send` is implemented for `futures_locks::RwLock<T>`
required because of the requirements on the impl of `std::marker::Send` for `Cell<*const futures_locks::RwLock<CasbinEnforcer>>`
required because of the requirements on the impl of `Sync` for `spin::once::Once<AsyncOnce<futures_locks::RwLock<CasbinEnforcer>>>`
shared static variables must have a type that implements `Sync`
`(dyn futures::Future<Output = futures_locks::RwLock<CasbinEnforcer>> + 'static)` cannot be sent between threads safely
the trait `std::marker::Send` is not implemented for `(dyn futures::Future<Output = futures_locks::RwLock<CasbinEnforcer>> + 'static)`
required because of the requirements on the impl of `std::marker::Send` for `Unique<(dyn futures::Future<Output = futures_locks::RwLock<CasbinEnforcer>> + 'static)>`
required because of the requirements on the impl of `std::marker::Send` for `std::sync::Mutex<std::result::Result<futures_locks::RwLock<CasbinEnforcer>, Pin<Box<(dyn futures::Future<Output = futures_locks::RwLock<CasbinEnforcer>> + 'static)>>>>`
required because of the requirements on the impl of `Sync` for `spin::once::Once<AsyncOnce<futures_locks::RwLock<CasbinEnforcer>>>`
shared static variables must have a type that implements `Sync`
Perhaps there is some kind of conflict between the use of future and lazy static in ras
Metadata
Metadata
Assignees
Labels
No labels