ic-storage 0.78.4

Named stable-memory allocations and governed upstream stable collections
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use super::BackingIdentity;
use std::{
    collections::BTreeSet,
    sync::{Mutex, PoisonError},
};

static CLAIMS: Mutex<BTreeSet<BackingIdentity>> = Mutex::new(BTreeSet::new());

pub(super) fn with_claims<T>(operation: impl FnOnce(&mut BTreeSet<BackingIdentity>) -> T) -> T {
    let mut claims = CLAIMS.lock().unwrap_or_else(PoisonError::into_inner);
    operation(&mut claims)
}