Amanieu / parking_lot

Compact and efficient synchronization primitives for Rust. Also provides an API for creating custom synchronization primitives.
Apache License 2.0
2.76k stars 217 forks source link

Add `lock_api::{Mutex, ReentrantMutex, RwLock}::from_raw` methods #426

Closed nspin closed 9 months ago

nspin commented 10 months ago

Addresses https://github.com/Amanieu/parking_lot/issues/400 by implementing https://github.com/Amanieu/parking_lot/issues/400#issuecomment-1888695827.

This PR adds from_raw methods for lock_api::{Mutex, ReentrantMutex, RwLock}. These have the same behavior as the existing legacy const_new methods.

These methods are useful with RawMutex, etc. implementations which don't support const initialization.