Lock hierarchy

This Rust crate offers debug assertions for violations of lock hierarchies. No runtime overhead or protection occurs for release builds.

Usage

```rust use lock_hierarchy::Mutex;

let mutexa = Mutex::new(()); // Level 0 let mutexb = Mutex::withlevel((), 0); // also level 0 // Fine, first mutex in thread let _guarda = mutexa.lock().unwrap(); // Must panic, lock hierarchy violation let _guardb = mutex_b.lock().unwrap(); ```

```rust use lock_hierarchy::Mutex;

let mutexa = Mutex::withlevel((), 1); // Level 1 let mutexb = Mutex::new(()); // level 0 // Fine, first mutex in thread let _guarda = mutexa.lock().unwrap(); // Fine: 0 is lower level than 1 let _guardb = mutex_b.lock().unwrap(); ```