b3_utils 0.13.1

Utility functions for building on the Internet Computer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::cell::Cell;

use crate::nonce::Nonce;

thread_local! {
    static LOG_ENTRY_COUNTER: Cell<Nonce> = Default::default();
}

pub fn log_increment() -> u64 {
    LOG_ENTRY_COUNTER.with(|cell| {
        let mut nonce = cell.take();
        nonce.increment();
        cell.set(nonce);

        nonce.get()
    })
}