1 unstable release

0.1.0 Apr 27, 2024

#657 in Concurrency

Download history 153/week @ 2024-08-18 235/week @ 2024-08-25 651/week @ 2024-09-01 622/week @ 2024-09-08 754/week @ 2024-09-15 693/week @ 2024-09-22 709/week @ 2024-09-29 897/week @ 2024-10-06 700/week @ 2024-10-13 872/week @ 2024-10-20 631/week @ 2024-10-27 1630/week @ 2024-11-03 829/week @ 2024-11-10 782/week @ 2024-11-17 673/week @ 2024-11-24 1761/week @ 2024-12-01

4,259 downloads per month
Used in 31 crates (9 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