1 unstable release

0.1.0 Apr 27, 2024

#625 in Concurrency

Download history 87/week @ 2024-07-22 82/week @ 2024-07-29 146/week @ 2024-08-05 169/week @ 2024-08-12 173/week @ 2024-08-19 291/week @ 2024-08-26 652/week @ 2024-09-02 650/week @ 2024-09-09 663/week @ 2024-09-16 924/week @ 2024-09-23 488/week @ 2024-09-30 970/week @ 2024-10-07 723/week @ 2024-10-14 816/week @ 2024-10-21 730/week @ 2024-10-28 1577/week @ 2024-11-04

3,957 downloads per month
Used in 10 crates (4 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