1 unstable release

0.1.0 Apr 27, 2024

#544 in Concurrency

Download history 34/week @ 2024-06-18 63/week @ 2024-06-25 20/week @ 2024-07-02 24/week @ 2024-07-09 44/week @ 2024-07-16 90/week @ 2024-07-23 103/week @ 2024-07-30 126/week @ 2024-08-06 180/week @ 2024-08-13 169/week @ 2024-08-20 419/week @ 2024-08-27 566/week @ 2024-09-03 669/week @ 2024-09-10 666/week @ 2024-09-17 947/week @ 2024-09-24 449/week @ 2024-10-01

2,788 downloads per month
Used in 8 crates (3 directly)

MIT license

4KB

Provides a simple trait that unwraps the locks provide by std::sync::RwLock.

In every case, this is the same as calling .expect("lock poisoned"). However, it does not use .unwrap() or .expect(), which makes it easier to distinguish from other forms of unwrapping when reading code.

use or_poisoned::OrPoisoned;
use std::sync::RwLock;

let lock = RwLock::new(String::from("Hello!"));

let read = lock.read().or_poisoned();
// this is identical to
let read = lock.read().unwrap();

lib.rs:

Provides a simple trait that unwraps the locks provide by std::sync::RwLock.

In every case, this is the same as calling .expect("lock poisoned"). However, it does not use .unwrap() or .expect(), which makes it easier to distinguish from other forms of unwrapping when reading code.

use or_poisoned::OrPoisoned;
use std::sync::RwLock;

let lock = RwLock::new(String::from("Hello!"));

let read = lock.read().or_poisoned();
// this is identical to
let read = lock.read().unwrap();

No runtime deps