rings-node 0.20.0

Rings is a structured peer-to-peer network implementation using WebRTC, Chord algorithm, and full WebAssembly (WASM) support.
Documentation
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)
}