rings-node 0.39.0

Rings is a browser-native, structured peer-to-peer network: browser tabs and native daemons find each other by DID and talk over WebRTC, routed by a Chord DHT.
1
2
3
4
5
6
7
8
9
10
use std::sync::Mutex;
use std::sync::MutexGuard;

use crate::error::Error;
use crate::error::Result;

/// Acquire one synchronous state lock through the crate's closed poison-error mapping.
pub(crate) fn lock<T>(state: &Mutex<T>) -> Result<MutexGuard<'_, T>> {
    state.lock().map_err(|_| Error::Lock)
}