#[cfg(not(test))]
use std::cell::Cell;
#[cfg(not(test))]
thread_local! {
static PARA_ID: Cell<u32> = const { Cell::new(1) };
}
#[cfg(not(test))]
pub fn generate_para_id() -> String {
let id = PARA_ID.with(|next| {
let id = next.get();
next.set(id.checked_add(1).expect("paragraph ID space exhausted"));
id
});
format!("{id:08x}")
}
#[cfg(not(test))]
pub fn reset_para_id() {
PARA_ID.set(1);
}
#[cfg(test)]
pub fn generate_para_id() -> String {
"12345678".to_owned()
}
#[cfg(test)]
pub fn reset_para_id() {
}