1 unstable release

0.1.0 Apr 27, 2024

#947 in Concurrency

Download history 606/week @ 2024-10-26 1497/week @ 2024-11-02 921/week @ 2024-11-09 801/week @ 2024-11-16 597/week @ 2024-11-23 1670/week @ 2024-11-30 2416/week @ 2024-12-07 2694/week @ 2024-12-14 2386/week @ 2024-12-21 2870/week @ 2024-12-28 3863/week @ 2025-01-04 5073/week @ 2025-01-11 4610/week @ 2025-01-18 4063/week @ 2025-01-25 5013/week @ 2025-02-01 5778/week @ 2025-02-08

20,271 downloads per month
Used in 85 crates (10 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