Crates.io | static_locks |
lib.rs | static_locks |
version | 0.1.0 |
source | src |
created_at | 2019-12-10 11:37:57.601008 |
updated_at | 2019-12-10 11:37:57.601008 |
description | The `parking_lot` locks but usable in statics and const fn. |
homepage | |
repository | https://github.com/thomcc/static_locks |
max_upload_size | |
id | 188206 |
size | 123,663 |
static_locks
The parking_lot
locks but modified
so that they can be used in statics on stable Rust.
The only thing preventing this was the fact that the API was implemented in a
generic way in lock_api
, and const trait bounds aren't fully supported yet.
All this crate does is manually monomorphize (expand) the generic
implementation, allowing Mutex::new
, RwLock::new
, and ReentrantMutex::new
,
etc to be used in statics.
It essentially exists so that you don't have to use a lazy_static or OnceCell for in cases where you shouldn't.
MutexGuard
with Condvar
from normal parking_lot
.static_locks::parking_lot::{...}
is available.Same as parking_lot
, down to the copyright attribution. The author of
stable_locks
claims no additional copyright over the changes to the
parking_lot code needed -- They were trivial.