1 unstable release

0.1.0 Apr 27, 2024

#862 in Concurrency

Download history 759/week @ 2024-09-20 788/week @ 2024-09-27 498/week @ 2024-10-04 962/week @ 2024-10-11 989/week @ 2024-10-18 606/week @ 2024-10-25 1347/week @ 2024-11-01 1062/week @ 2024-11-08 791/week @ 2024-11-15 623/week @ 2024-11-22 1452/week @ 2024-11-29 2423/week @ 2024-12-06 2682/week @ 2024-12-13 2258/week @ 2024-12-20 2923/week @ 2024-12-27 3742/week @ 2025-01-03

11,938 downloads per month
Used in 61 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