junobuild-auth 0.4.2

Authentication toolkit for Juno.
Documentation
1
2
3
4
5
6
7
8
9
10
use crate::state::memory::STATE;
use crate::state::types::runtime_state::State;

pub fn read_state<R>(f: impl FnOnce(&State) -> R) -> R {
    STATE.with(|cell| f(&cell.borrow()))
}

pub fn mutate_state<R>(f: impl FnOnce(&mut State) -> R) -> R {
    STATE.with(|cell| f(&mut cell.borrow_mut()))
}